Issue: Improve Error Handling and Provide Detailed Error Messages #82
Labels
component:js sdk
Issue/PR related to JavaScript SDK
status:triaged
Issue/PR triaged to the corresponding sub-team
type:bug
Something isn't working
Firstly, Thanks for the work on this library :)
Expected Behavior
When an error occurs while using the API, the error message should be structured in a way that makes it easy to extract the reason for the failure. Currently, the error message is all squashed into one, making it tedious to get the
reason
property from the object, as shown in the following image:Additionally, since the error is of the type
any
, it makes it difficult to tap into the reason for the failure, as shown in the following image:Workaround
To work around this issue, the user has to manually parse the error message to extract the reason for the failure, as shown in the following code snippet:
This workaround allows the user to extract the reason for the failure, as shown in the following image:
Proposed Solution
To improve the error handling and provide more detailed error messages, I suggest the following:
Error
class and includes properties for the error code, reason, and any other relevant information.This approach will provide a more structured and informative error handling experience for the users of the library.
Repo Link
The repository where I encountered this issue is Genie.
The text was updated successfully, but these errors were encountered: