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

Unify error format #8

Closed
dompuiu opened this issue Jun 6, 2019 · 3 comments
Closed

Unify error format #8

dompuiu opened this issue Jun 6, 2019 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@dompuiu
Copy link
Member

dompuiu commented Jun 6, 2019

Expected Behaviour

Let's say we have the following code:

auth(config)
  .then(token => console.log(token))
  .catch(error => console.log(`Error retrieving access token. ${error}`));

Sometimes jwt-auth throws a native error (eg. if we feed a public key as a private key). Other times it throws a native object (for JSON errors thrown by the API). It will be helpful to have one type of error.

Actual Behaviour

In the case when an object is thrown as an error, the native object toString method will return
[object Object]. Our error looks like Error retrieving the access token. [object Object] which is not optimal.

@shazron
Copy link
Member

shazron commented Jun 6, 2019

Can we wrap this into #9?

@dompuiu
Copy link
Member Author

dompuiu commented Jun 6, 2019

Yes. But it is @Aaronius fault that he doesn't read the comments from the PR request form. :p

@macdonst macdonst added the duplicate This issue or pull request already exists label Jun 10, 2019
@macdonst
Copy link
Contributor

@dompuiu I'm going to mark this as a duplicate of #9 even though your's was the earlier issue. Should have a fix this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants