When should you throw 500 internal server error?

When should you throw 500 internal server error?

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.

Can we catch 500 internal server error?

While not probable, it is possible that there’s something wrong on your end, in which case we’ll look at some things you can try: Reload the web page. Even if the 500 Internal Server Error is a problem on the web server, the issue might just be temporary. Trying the page again will often be successful.

Why do I get an internal server error?

An internal server error happens when the server encounters a situation it doesn’t know how to handle. Occasionally, your browser can be the source of these kinds of errors. You can try these steps to see if they’ll help: Clear the browser cache.

When to return error code 500 in REST API?

We are building a new REST API. I was arguing that error code 500 (Internal Server Error) should never be returned. Now, of course if you know the client’s params are wrong or something you have everything under control and can return some appropriate error code (e.g. 422). So if an unexpected error occurs the server could:

Why is the error code 500 Internal Server Error?

There’s nothing “internal” about the code “500 Internal Server Error” in the sense that it shouldn’t be exposed to the client. The real question is why does it generate a 500 error.

What does a 404 not found mean in REST API?

A 404 or 500 would indicate that the path (/restapi/deviceinfo) is either not found or resulted in a server error. In the second case, the device ID is part of the URL. I would be more understanding of a 404 Not Found, but still could argue based on which parts of the path are interpreted as variables versus endpoints.

Why do I have a 500 response code?

All unhandled exceptions should result in a 500 response code. The fact there’s an unexpected situation in your software has nothing to do with the user’s request, it’s clearly an issue on the server side, hence the 500 code. Unexpected situations show themselves up as unhandled exceptions: either bugs or hardware failures.