code: def handle_exception(error):
      
      try:
          if _get_acceptable_response_type() == JSON:
              response = jsonify(error.to_dict())
              response.status_code = error.code
              return response
          else:
              return error.abort()
      except InvalidAPIUsage:
          # In addition to the original exception, we don't support the content
          # type in the request's 'Accept' header, which is a more important
          # error, so return that instead of what was originally raised.
          response = jsonify(error.to_dict())
          response.status_code = 415
          return response
docs: Return a response with the appropriate status code, message, and content
      type when an ``InvalidAPIUsage`` exception is raised.