code: def build_error(self, err):
          
          data = {
              'error': err.args[0],
          }
  
          if self.is_debug():
              # Add the traceback.
              data['traceback'] = format_traceback(sys.exc_info())
  
          body = self.serializer.serialize(data)
          status = getattr(err, 'status', 500)
          return self.build_response(body, status=status)
docs: When an exception is encountered, this generates a JSON error message
          for display to the user.
  
          :param err: The exception seen. The message is exposed to the user, so
              beware of sensitive data leaking.
          :type err: Exception
  
          :returns: A response object