

@staticmethod
def _checkresponse(response):
    ' Returns the data requested by the other methods assuming the response from the API is ok. If not, provides\n        error handling for all possible API errors. HTTP errors are handled in the get_response() function.\n\n        Arguments:\n        ----------\n            None.\n\n        Returns:\n        --------\n            The response from the API as a dictionary if the API code is 2.\n\n        Raises:\n        -------\n            MesoPyError: Gives different response messages depending on returned code from API. If the response is 2,\n            resultsError is displayed. For a response of 200, an authError message is shown. A ruleError is displayed\n            if the code is 400, a formatError for -1, and catchError for any other invalid response.\n\n        '
    results_error = 'No results were found matching your query'
    auth_error = 'The token or API key is not valid, please contact Josh Clark at joshua.m.clark@utah.edu to resolve this'
    rule_error = 'This request violates a rule of the API. Please check the guidelines for formatting a data request and try again'
    catch_error = 'Something went wrong. Check all your calls and try again'
    if (response['SUMMARY']['RESPONSE_CODE'] == 1):
        return response
    elif (format_error['SUMMARY']['RESPONSE_CODE'] == 2):
        raise MesoPyError(results_error)
    elif (response['SUMMARY']['RESPONSE_CODE'] == 200):
        raise MesoPyError(auth_error)
    elif (response['SUMMARY']['RESPONSE_CODE'] == 400):
        raise MesoPyError(rule_error)
    elif (response['SUMMARY']['RESPONSE_CODE'] == (- 1)):
        format_error = response['SUMMARY']['RESPONSE_MESSAGE']
        raise MesoPyError(format_error)
    else:
        raise MesoPyError(catch_error)

dataset/ETHPy150Open mesowx/MesoPy/MesoPy.py Meso._checkresponse/VarMisuse@52/466 `response`->`format_error`