Yogesh Chauhan's Blog

The difference between 400(4xx) and 500(5xx) errors

in Miscellaneous on February 23, 2020

The main difference between the two is whose fault that error is. A 4xx code indicates an error caused by the user, whereas 5xx codes tell the client that they did everything correctly and it’s the server itself who caused the problem.

When should we return 4xx or 5xx status codes to the client?

4xx codes are used to tell the client that a fault has taken place on THEIR side. They should not retransmit the same request again, but fix the error first.

5xx codes tell the client something happened on the server and their request by itself was perfectly valid. The client can continue and try again with the request without modification.


Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
SQL ANY OperatorSQL/MySQLAdd animated hamburgers menu using Hamburgers collection on GitHubCSSHow to modify AutoSave Interval using code in WordPress?WordPressWhat does useEffect do in React?ReactPHP arrays for US states’ full names and abbreviationsPHPA simple example on grid ‘auto-fill’ vs ‘auto-fit’CSSFULL OUTER JOIN in PostgresPostgresArray.from() Method in JavaScriptJavaScriptUnderstanding the confusing and handy “This” keyword in JavaScriptJavaScriptThe difference between Class declarations and Class expressions in JavaScriptJavaScriptColleague UI Basics: The Context AreaColleagueHow to Write Complex Search Queries in SQL?SQL/MySQL