By default, SharePoint returns the 404 error which is "file not found" error returned by the IIS Server  to the browser. 
The error message displayed might not be useful to the end user, requirement comes when one wants to provide some meaningful error message to the end user, this can be done very easily in SharePoint
 
Steps required to do so: