Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core::throwError should throw error and not an object #21

Open
wodka opened this issue Nov 15, 2021 · 4 comments · May be fixed by #25
Open

Core::throwError should throw error and not an object #21

wodka opened this issue Nov 15, 2021 · 4 comments · May be fixed by #25
Labels
Waiting_on_requestor Issues/PR where we have responded and are currently waiting on the requestor to respond back

Comments

@wodka
Copy link
Contributor

wodka commented Nov 15, 2021

Currently the throwError static function will return an object and not an error.

static throwError(callBack,type,httpStatusCode, errorCode, message, detail?) {

This makes it problematic in terms of using it in other error management tools like Sentry.

image

@ralphstodomingo
Copy link

After going through the source code, detail there is probably what you're looking for?

@cb-niravjadav
Copy link

@wodka, You may write wrapper callback function and try to use Sentry from there. Please let us know if this is feasible for you.

@cb-yateshmathuria cb-yateshmathuria added the Waiting_on_requestor Issues/PR where we have responded and are currently waiting on the requestor to respond back label Dec 16, 2021
wodka added a commit to wodka/chargebee-typescript that referenced this issue Dec 16, 2021
@wodka
Copy link
Contributor Author

wodka commented Dec 16, 2021

@ralph-remo it's really more about allowing other tools to use the primitives of javascript to detect errors. This is harder when using objects that are not extending Error.

@cb-niravjadav I've just created a PR #25 with a new env config option useErrorObject that would allow anyone to change the behaviour from throwing an object to throwing an error.

@wodka
Copy link
Contributor Author

wodka commented Dec 16, 2021

Further: https://github.com/chargebee/chargebee-typescript/blob/master/README.md#error-handling mentions that is should be possible to check for the param in the error.

image

That value is never set? Should this be the general area / resource?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting_on_requestor Issues/PR where we have responded and are currently waiting on the requestor to respond back
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants