Читать книгу SAS Viya - Kevin D. Smith - Страница 29

Dealing with Errors

Оглавление

The issue of CAS action errors was discussed to some extent previously in the chapter. There are two methods for dealing with CAS action errors: return codes and exceptions. The default behavior is to surface return codes, but SWAT can be configured to raise exceptions. In the case of return codes, they are

available in the severity attribute of the CASResults object that is returned by CAS action methods. The possible values are shown in the following table:

Severity Description
0 An action was executed with no warnings or errors.
1 Warnings were generated.
2 An error occurred.

In addition to the severity attribute, the CASResults object has an attribute named reason, which is a string that contains the general reason for the warning or error. The possible reasons are shown in the following table:

Reason Description
ok The action was executed with no warnings or errors.
abort The action was aborted.
authentication The action could not authenticate user credentials.
authorization The action was unable to access a resource due to permissions settings.
exception An exception occurred during the execution of an action.
expired-token An authentication token expired.
io An input/output error occurred.
memory Out of memory.
network Networking failure.
session-retry An action restarted and results already returned should be ignored.
unknown The reason is unknown.

The last two attributes to note are status and status_code. The status attribute of CASResults contains a human-readable formatted message that describes the action result. The status_code is a numeric code that can be supplied to Technical Support if further assistance is required. The code contains information that might be useful to Technical Support for determining the source of the problem.

SAS Viya

Подняться наверх