-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3-confusing-error-message'
- Loading branch information
Showing
4 changed files
with
41 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ export interface AccountResponse{ | |
accountAccess: { | ||
account: { | ||
accountId: string; | ||
} | ||
}; | ||
}[]; | ||
} |
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,24 @@ | ||
import { isNullOrUndefined } from '../utils'; | ||
|
||
export interface AferoErrorResponse{ | ||
/** UNIX timestamp of the request */ | ||
timestamp: number; | ||
/** Request response code */ | ||
status: number; | ||
/** Description of the error */ | ||
error_description: string; | ||
/** URL of the request */ | ||
path: string; | ||
} | ||
|
||
/** | ||
* Checks whether error is caused by Afero response | ||
* @param error Error object to check | ||
* @returns True if error is from Afero | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export function isAferoError(error: any): error is AferoErrorResponse{ | ||
if(error === null || typeof error !== 'object') return false; | ||
|
||
return isNullOrUndefined(error.timestamp, error.status, error.status_description, error.path); | ||
} |
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