The server API reports errors using the standard mechanism for your language.
For Python, Ruby and PHP, the API calls can throw exceptions that you should catch in your code. Node.js uses error callbacks that have a parameter derived from the Error class, while Go handles errors using return values.

Our naming convention for the error objects is consistent across all of the languages. The names of the objects and their meanings are shown below.

Error classDescription
AuthenticationErrorYour API credentials could not be verified
NotFoundErrorThe requested resource could not be found
ValidationErrorThe request contained a field that couldn't be validated
GenericErrorAn error that didn't match any of the above
InternalErrorSomething went wrong on the ProcessOut side. This is extremely rare
# Error handling with curl should be handled by checking the status
# codes of the responses. Non 2xx response codes usually mean an error
# occured during the request
// Promises should be used to check for any error
// and/or success of the request.
// Let's assume invoice has already been instantiated

invoice.save().then(
    function(invoice) {
        // Here, the request was successful, and invoice
        // has been filled with the response's data. You
        // may continue your work here, safe.

    }, function(err) {
        // An error occured during the request. You may
        // check the error message in err.
        console.log(err);

    });
from processout.errors.authenticationerror import AuthenticationError
from processout.errors.notfounderror       import NotFoundError
from processout.errors.validationerror     import ValidationError
from processout.errors.genericerror        import GenericError
from processout.errors.internalerror       import InternalError

# Different type of exceptions may be thrown by the
# ProcessOut's Python library, depending on the situation.

try:
    # Some ProcessOut related code
    pass

except AuthenticationError as e:
    print("Your API credentials couldn't be verified. " + str(e))

except NotFoundError as e:
    print("The requested resource could not be found. " + str(e))

except ValidationError as e:
    print("This error describes a validation error. " + str(e))

except GenericError as e:
    print("This is an error that didn't match any of the above. " + str(e))

except InternalError as e:
    print("Something went wrong on the ProcessOut side. This is extremely rare. " + str(e))
require "processout"

# Different type of exceptions may be thrown by the
# ProcessOut's Python library, depending on the situation.

begin
    # Some ProcessOut related code

rescue ProcessOut::AuthenticationError => e:
    puts "Your API credentials couldn't be verified. " + str(e)
rescue ProcessOut::NotFoundError => e:
    print("The requested resource could not be found. " + str(e))
rescue ProcessOut::ValidationError => e:
    print("This error describes a validation error. " + str(e))
rescue ProcessOut::GenericError => e:
    print("This is an error that didn't match any of the above. " + str(e))
rescue ProcessOut::InternalError => e:
    print("Something went wrong on the ProcessOut side. This is extremely rare. " + str(e))
end
<?php
// Different type of exceptions may be thrown by the
// ProcessOut's PHP library, depending on the situation.

try
{
    // Some ProcessOut related code
}
catch(ProcessOut\Exceptions\AuthenticationException $e)
{
    // Your API credentials couldn't be verified
    echo $e->getMessage();
}
catch(ProcessOut\Exceptions\NotFoundException $e)
{
    // The requested resource could not be found
    echo $e->getMessage();
}
catch(ProcessOut\Exceptions\ValidationException $e)
{
    // This error describes a validation error
    echo $e->getMessage();
}
catch(ProcessOut\Exceptions\GenericException $e)
{
    // This is an error that didn't match any of the above
    echo $e->getMessage();
}
catch(ProcessOut\Exceptions\InternalException $e)
{
    // Something went wrong on the ProcessOut side. This 
    // is extremely rare
    echo $e->getMessage();
}
// Different type of errors are returned by the ProcessOut's
// Go library, depending on the situation

switch e := err.(type) {
case *processout.AuthenticationError:
    // Your API credentials couldn't be verified
case *processout.NotFoundError:
    // The requested resource could not be found
case *processout.ValidationError:
    // This error describes a validation error
case *processout.GenericError:
    // This is an error that didn't match any of the above
case *processout.InternalError:
    // Something went wrong on the ProcessOut side. This 
    // is extremely rare

default:
    // The error comes from somewhere else, perhaps
    // json unmarshaller
}