concept custom error in category go
appears as: custom errors, custom error, custom errors

This is an excerpt from Manning's book Go in Practice.
You don’t have much room for customization when using the Error function within the http package. The response type is hardcoded as plain text, and the X-Content-Type-Options header is set to nosniff. This header tells some tools, such as Microsoft Internet Explorer and Google Chrome, to not attempt to detect a content type other than what was set. This leaves little opportunity to provide a custom error, aside from the content of the plain text string.