-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added default values for all getters very imp!
- Loading branch information
1 parent
cc6dc10
commit c6bf58d
Showing
7 changed files
with
85 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const STRING_VALIDATION_LENGTH = 3; | ||
export const TEST_DEFAULT_TIMEOUT = 10000; | ||
export const DEFAULT_TAKE_LIMIT = 15; |
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
export const errorHandler = (error: any): string => { | ||
if (typeof error === 'object' && error !== null && 'message' in error) { | ||
return error.message; | ||
} else { | ||
return 'Something went wrong!'; | ||
if (typeof error === 'object' && error !== null) { | ||
if ( | ||
Array.isArray(error.errors) && | ||
error.errors.length > 0 && | ||
'message' in error.errors[0] | ||
) { | ||
return error.errors[0].message; | ||
} else if ('message' in error) { | ||
return error.message; | ||
} | ||
} | ||
|
||
return 'Something went wrong!'; | ||
}; |