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

fix(firebase-auth): throw HTTPException instead of reponse null #191

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

Code-Hex
Copy link
Contributor

@Code-Hex Code-Hex commented Oct 5, 2023

I made to throw HTTPException instead of response null 401.

See: #185

Now, we can achieve our own error handling like the below:

app.onError((e, c) => {
  if (e instanceof HTTPException && e.status === 401) {
    return c.json(
      {
        message: 'Custom error message!',
      },
      401
    )
  }
  return c.text('Internal Server Error', 500)
})

@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2023

🦋 Changeset detected

Latest commit: 80325f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/firebase-auth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@yusukebe
Copy link
Member

yusukebe commented Oct 5, 2023

Thanks @Code-Hex !

Let's go with it!

@yusukebe yusukebe merged commit 794f03c into honojs:main Oct 5, 2023
1 check passed
@github-actions github-actions bot mentioned this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants