docs: def throws_errors(func):
      """
      Wraps a function responsible for implementing an API endpoint such that
      any server errors that are thrown are automatically transformed into
      appropriate HTTP responses.
      """
      @wraps(func)
      def wrapper(*args, **kwargs):
          response = func(*args, **kwargs)
  
          # if no status code is provided, assume 400
          if isinstance(response, BugZooException):
              err_jsn = flask.jsonify(response.to_dict())
              return err_jsn, 400
  
          if isinstance(response, tuple) \
             and isinstance(response[0], BugZooException):
              err = response[0] # type: BugZooException
              err_jsn = flask.jsonify(err.to_dict())
              return (err_jsn, *response[1:])
  
          return response
  
      return wrapper