-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Compass types and errors (#92)
* Use unknown instead of any * Improve compass error detection and thrown * Variables make optional as in interface * Increase version to 0.1.6 * Fix test * Errors available on CompassRequestError * yarn install * Add status 200 to fake compass request
- Loading branch information
Showing
12 changed files
with
100 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/providers/src/ports/CompassProvider/errors/CompassRequestError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CompassErrors } from '../types/CompassErrors'; | ||
import { CompassError } from '../types/CompassError'; | ||
|
||
export class CompassRequestError extends Error { | ||
public errors: CompassError[]; | ||
|
||
constructor(compassErrors: CompassErrors) { | ||
super( | ||
`Error fetching Compass data: ${compassErrors.errors.map((error) => error.message).join(', ')}`, | ||
); | ||
this.errors = compassErrors.errors; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/providers/src/ports/CompassProvider/types/CompassError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface CompassError { | ||
message: string; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/providers/src/ports/CompassProvider/types/CompassErrors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { CompassError } from './CompassError'; | ||
|
||
export interface CompassErrors { | ||
errors: CompassError[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -884,17 +884,17 @@ __metadata: | |
version: 0.0.0-use.local | ||
resolution: "@poap-xyz/drops@workspace:packages/drops" | ||
dependencies: | ||
"@poap-xyz/providers": 0.1.0 | ||
"@poap-xyz/utils": 0.1.0 | ||
"@poap-xyz/providers": 0.1.6 | ||
"@poap-xyz/utils": 0.1.6 | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"@poap-xyz/moments@*, @poap-xyz/moments@workspace:packages/moments": | ||
version: 0.0.0-use.local | ||
resolution: "@poap-xyz/moments@workspace:packages/moments" | ||
dependencies: | ||
"@poap-xyz/providers": 0.1.0 | ||
"@poap-xyz/utils": 0.1.0 | ||
"@poap-xyz/providers": 0.1.6 | ||
"@poap-xyz/utils": 0.1.6 | ||
"@types/uuid": ^9.0.2 | ||
uuid: ^9.0.0 | ||
languageName: unknown | ||
|
@@ -904,44 +904,27 @@ __metadata: | |
version: 0.0.0-use.local | ||
resolution: "@poap-xyz/poaps@workspace:packages/poaps" | ||
dependencies: | ||
"@poap-xyz/providers": 0.1.0 | ||
"@poap-xyz/utils": 0.1.0 | ||
"@poap-xyz/providers": 0.1.6 | ||
"@poap-xyz/utils": 0.1.6 | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"@poap-xyz/providers@*, @poap-xyz/providers@workspace:packages/providers": | ||
"@poap-xyz/providers@*, @poap-xyz/providers@0.1.6, @poap-xyz/providers@workspace:packages/providers": | ||
version: 0.0.0-use.local | ||
resolution: "@poap-xyz/providers@workspace:packages/providers" | ||
dependencies: | ||
"@poap-xyz/utils": 0.1.0 | ||
"@poap-xyz/utils": 0.1.6 | ||
axios: ^1.3.5 | ||
axios-mock-adapter: ^1.21.4 | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"@poap-xyz/providers@npm:0.1.0": | ||
version: 0.1.0 | ||
resolution: "@poap-xyz/providers@npm:0.1.0" | ||
dependencies: | ||
"@poap-xyz/utils": 0.1.0 | ||
axios: ^1.3.5 | ||
checksum: fe7f03cac15f160f0426d3084e020f2892f14439885ad8fd61dd96faec88dc45b02cedfdb861f742c8bc8f90ca4392facb11ac16ad73e6c2fa669592878071d3 | ||
languageName: node | ||
linkType: hard | ||
|
||
"@poap-xyz/utils@*, @poap-xyz/utils@workspace:packages/utils": | ||
"@poap-xyz/utils@*, @poap-xyz/[email protected], @poap-xyz/utils@workspace:packages/utils": | ||
version: 0.0.0-use.local | ||
resolution: "@poap-xyz/utils@workspace:packages/utils" | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"@poap-xyz/utils@npm:0.1.0": | ||
version: 0.1.0 | ||
resolution: "@poap-xyz/utils@npm:0.1.0" | ||
checksum: 3571311ad244f2a358e34752a2fc4d13f5ce2bb5b1facbd6824dbe6bd1b73e9cb94791989e8f22b89dee10877a3d5bca1ee093bbc0a3bb25b76bd5a5e966318a | ||
languageName: node | ||
linkType: hard | ||
|
||
"@rollup/plugin-commonjs@npm:^25.0.7": | ||
version: 25.0.7 | ||
resolution: "@rollup/plugin-commonjs@npm:25.0.7" | ||
|