Catch exception

The Catch Exception Action Node is used to execute an action when an error occurs.

When an error occurs in an action node, normal execution of the action will stop, and Appfarm will look for a Catch Exception Action Node. It will first look downward on the same level, then go up one level to look for it there (top-down), and so on. When it finds a catch block that meets the criteria of the error, the catch will execute whatever is defined inside it and then resume execution starting with the node directly after the catch (unless you use end execution or some other flow-changing action).

Settings

Catch All

If selected, all types of errors will trigger the execution of the action nodes inside the action.

Execution Types

If Catch All is not selected, you need to define the execution type(s) that shall be caught. Four different options are available, and have a set of different properties.

Delete Constraint Exception

Used when there's a Delete Rule on a relation in the database, and the user tries to delete a parent. As long as objects in an object class have reference to a remote object class, deletions of referenced objects will not be allowed, i.e., if objects in the Project object class reference a Person object, it will not be possible to delete that Person object.

Web Request Error

Used when a web request returns an error, i.e., 400 or 500 error codes. If you don't want the action node to catch all exceptions, you might define specific HTTP Error Codes to be caught by the action node.

Custom Exception

Used when a Throw Exception Action Node returns an error. If you don't want the action node to catch all custom exceptions, you can define specific error codes that should be caught by the action node.

Defined Errors

Used when Appfarm returns an error. Only the error codes you define will be caught by the action node. Here is a list of relevant Appfarm Error Codes.

NameCodeHTTP Status Code

UniquenessConstraintError

34002

500

MissingRequiredFieldsError

34003

500

InsuficientCreatePermissionError

34004

403

InsuficientUpdatePermissionError

34006

403

InsuficientDeletePermissionError

34007

403

DeleteConstraintException

34011

500

PropertyValidationError

34012

400

UpdateReadOnlyError

34008

403

PersistError

34010

500

UpdateObjectError

34009

500

WebRequestException

17003

500

WebRequestTimeoutException

17005

0

WebRequestAbortedException

17006

0

GetUserMediaNotAllowedError

17004

500

AppfarmCustomException

17001

500

31500

500

11005

404

14007

403

13005

500

14400

400

11404

403

QuotaExceededException

14009

422

SmsDisabledException

35001

DailyQuotaExceededException

35002

MonthlyQuotaExceededException

35003

16002

500

16003

500

Result mapping

Result mapping might be used to map error data to Data Sources. The following data is available:

KeyData

httpStatusCode

Error code

code

Internal Appfarm error code

name

Error name

message

Error message

body

Web Request response data

The data is returned as a JSON object, and body data can be mapped by setting RootPath to body.theKeyYouWant.

{
    httpStatusCode: integer,
    code: integer,
    name: String,
    message: String,
    body: {}
}

Last updated