added the possibility of a customized error response