http error handler more flexible