What Error Responses Look Like

Sometimes API methods fail and return various exceptions. The causes for these are many, but are generally caused by invalid or missing input. In general, the response you receive will contain the keys 'error_class', 'full_message', and possibly some other helpful fields specific to that error type.

For example, if you were to request an API method that does not exist (/blah/blah/blah), you would get this back:

	JSON:

	{
		"error_class"   : "LW::Exception::API::InvalidMethod",
		"full_message"  : "Invalid API Method: blah/blah/blah",
		"method"        : "blah/blah/blah"
	}

In general, you should always look for an 'error_class' key in the response to know whether your request was successful or not.

Possible Error Classes

Here is a list of possible exception types returned by our system. Not all apply to every method, but the list should be fairly exhaustive.

LW::Exception::API::Internal

The public API got a non-public error.

Extra keys returned by this exception class:

public_message
	

LW::Exception::API::InvalidEncoding

A request request an encoding that is not supported.

Extra keys returned by this exception class:

encoding
	

LW::Exception::API::InvalidMethod

A request was sent for a method that does not exist.

Extra keys returned by this exception class:

method
	

LW::Exception::API::Maintenance

The API is currently undergoing maintenance.

LW::Exception::API::RateLimit

A request violated rate limit rules.

Extra keys returned by this exception class:

account
ip
method
	

LW::Exception::Authorization

An attempt at authorization failed

Extra keys returned by this exception class:

username
	

LW::Exception::CCTrans

A credit card transaction failed.

Extra keys returned by this exception class:

message_code
message_text
reason_code
trans_id
	

LW::Exception::CCTrans::Declined

A credit card transaction was declined.

Extra keys returned by this exception class:

dup_trans
message_code
message_text
reason_code
trans_id
	

LW::Exception::CCTrans::Expired

A credit card authorization could not be captured because it has expired.

Extra keys returned by this exception class:

message_code
message_text
reason_code
trans_id
	

LW::Exception::DNS::NoResponse

No response from one or more nameservers

Extra keys returned by this exception class:

nameservers
	

LW::Exception::DNS::Servfail

SERVFAIL response from nameserver

Extra keys returned by this exception class:

nameservers
	

LW::Exception::Deserialize

The given data could not be de-serialized

Extra keys returned by this exception class:

data
encoding
	

LW::Exception::DuplicateRecord

Duplicates were found, or would have been created.

Extra keys returned by this exception class:

field
input
statement
	

LW::Exception::Forbidden

You tried to perform an operation that is not allowed

LW::Exception::Incapable

You tried to perform an operation that cannot be done.

Extra keys returned by this exception class:

capability
thing
	

LW::Exception::Input

Super class for input exceptions.

Extra keys returned by this exception class:

field
	

LW::Exception::Input::Conflicting

Input was provided for two or more fields where one field contradicts another.

Extra keys returned by this exception class:

field
fields
	

LW::Exception::Input::Disallowed

Input was provided in a context where no input is permitted (e.g. params were provided to a read-only method)

Extra keys returned by this exception class:

field
	

LW::Exception::Input::Multiple

An exception containing multiple LW::Exception::Input exceptions

Extra keys returned by this exception class:

errors
field
type
	

LW::Exception::Input::NotInRealm

An input parameter was not among the acceptable set of values for the specified field.

Extra keys returned by this exception class:

field
valid
value
	

LW::Exception::Input::OutOfBounds

An input parameter was not within the permitted range of values.

Extra keys returned by this exception class:

field
max
min
value
	

LW::Exception::Input::Required

A required input parameter was not given.

Extra keys returned by this exception class:

field
position
	

LW::Exception::Input::Unknown

An input was given for a nonexistent field.

Extra keys returned by this exception class:

field
value
	

LW::Exception::Input::Validation

An input parameter failed validation.

Extra keys returned by this exception class:

field
type
value
	

LW::Exception::Permission

An attempt was made to access an object with insufficient permissions.

Extra keys returned by this exception class:

account
identifier
	

LW::Exception::Provision::Task::Delay

Thrown when task is re-run with delay

Extra keys returned by this exception class:

timer
	

LW::Exception::RecordNotFound

Valid input was given, but no matching record was found.

Extra keys returned by this exception class:

field
input
	

LW::Exception::RemoteService::Authorization

The remote service rejected authorization credentials.

Extra keys returned by this exception class:

public_message
url
	

LW::Exception::RemoteService::Authorization::TwoFactor::PasscodeRequired

The remote service requires a two-factor authentication (TFA) passcode as well as other authorization credentials.

Extra keys returned by this exception class:

public_message
url
	

LW::Exception::Resource

Base class for resource exceptions.

Extra keys returned by this exception class:

resource
	

LW::Exception::Resource::Insufficient

The resource is insufficent for the operation.

Extra keys returned by this exception class:

available
requested
resource
	

LW::Exception::Resource::Unavailable

A needed resource could not be acquired.

Extra keys returned by this exception class:

resource
	

LW::Exception::Serialize

The given data could not be serialized

Extra keys returned by this exception class:

data
encoding
	

LW::Exception::Ticketed

An exception containing a set of exceptions, and the ticket addressing them

Extra keys returned by this exception class:

errors
ticket_id
	

LW::Exception::Transaction::Declined

Some sort of cash transaction was declined.

LW::Exception::Workflow::Conflict

The attempted workflow conflicts with a running workflow

Extra keys returned by this exception class:

conflict
workflow