question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customization on error response

See original GitHub issue

How to properly handle response? I created an ~error.vue and it works for other error responses like 404 response but not on 429.

Version

nuxt-security: ^0.9.0 nuxt: 3.0.0

Reproduction Link

What is Expected?

I was expecting to customize the error response like redirecting to another page or customize the default response.

What is actually happening?

I am getting the default error response from nuxt Screenshot 2022-12-16 at 2 45 58 AM

Thank you

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Baroshemcommented, Dec 20, 2022

@ReaganM02

You are in the right place 😉

Are you using the correct branch? It should be feat/optional-throw-error

1reaction
Baroshemcommented, Dec 16, 2022

I cannot pass the method as it is removed from the config in the middleware. Instead, I will add an optional property called throwError. By default it has a value of true and will throw an error once certain condition is met (for example 429 after too many requests from rate limiter). But when set to false, it will return an object with the error but will not throw an error. Thanks to this approach you will be able to take this object and do whatever you want with it. For example show a custom error. I will create a pull request with this functionality for you to check out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Implement Custom Error Responses in Express - Auth0
Learn why you may need custom error responses on 4xx errors, what a good custom format looks like, and how to apply it...
Read more >
Error response customization (beta) - Akamai TechDocs
You can customize responses related to the following errors: API key invalid. The API key in the incoming request does not exist in...
Read more >
Custom Error Message Handling for REST API - Baeldung
Custom Error Message Handling for REST API · 1. Overview · 2. A Custom Error Message · 3. Handle Bad Request Exceptions ·...
Read more >
Amazon API Gateway Enables Customization of Error ... - AWS
Now, you can customize the responses returned by your API Gateway APIs so that they provide useful information to your client applications.
Read more >
Custom error responses (beta) · Cloudflare Rules docs
Custom error responses, powered by the Ruleset Engine, allow you to define custom responses for errors returned by an origin server or by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found