Handle not found from API call on server-side
See original GitHub issueHi,
I’m trying to figure out how to return 404 server-side when the id
cannot be found in the API. The route is looking something like this /:id
. I know this example app does not cover that case but maybe all you smart people here have some pointers? Given the solution I’ll be happy to add it here.
Cheers, K
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Handling Exceptions Returned from the Web API
You'll learn to determine what kind of error is returned from your Web API call and display different messages based on those errors....
Read more >Handle Resource not found in Rest API - Stack Overflow
The server has not found anything matching the requested address (URI) ( not found ). This means the URL you have typed is...
Read more >Best Practices for REST API Error Handling - Baeldung
Learn about some of the best practices for handling REST API errors, including useful approaches for providing users with additional ...
Read more >10 Error Status Codes When Building APIs For The First Time ...
Usually, an HTTP request with an inappropriate method simply results in a 404 not found status. A not-implemented status implies that the method ......
Read more >Best practices for API error handling and troubleshooting
On server side, Orange APIs handle errors by aborting the request and immediately returning an error response to your application.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When your application requests a record, the JSON API responds with an error code like 404, and possibly additional information like a “Record not found”-message. It is up to the client to implement how this information is displayed to the user. Setup a route like
/users/:id
in the routes file on the server and have the linked component deal with the scenarios of both the record being available and not being available.Are you referring to a route that can’t be mapped to an action? That defaults to 404 here. If you want to return a 404 from an api action you can pass a status like this: