def _printErrorMessage(response):
    """
    Method to print infromation of an error returned by the API to the console
    Builds the error description from the response object 
    """
    status = response.status_code
    if status == 400:
        print('\nError 400 - Bad Request: {:s}'.format(response.url))
        payload = response.json()
        if len(payload) >= 1:
            for e in payload['errors']:
                code = e['errorCode']
                msg = e['errorMessage']
                parameters = e['parameter']
                print('   Error {:d}: {:s} (parameter: {})'.format(code,
                    msg, parameters))
    elif status == 401:
        print('Error 401 - Unauthorized: {:s}'.format(response.url))
        print(
            'Please check that your Web Services API token is valid. Find your token in your registered profile at https://data.oceannetworks.ca.'
            )
    else:
        msg = '\nError {:d} - {:s}\n'.format(status, response.reason)
        print(msg)
