This feature will provide benefit for speed up development for multiple error cases in the application.
The base template in the Smartface covers multilanguage error messages, also error logging for the Smartface Enterprise Server / Smartface Cloud Services. This default behavior is customizable.
If the error is handled with try catch block or with the error event(s) of the raising object, Application.onError event is not raised.
The thrown error object is passed as a parameter to the event function. This object is wrapped with type information regarding which type of this error is. This information is accessible with the “type” property of the “e” parameter object.
Error types are:
• Server Error
• Size Overflow
The properties of the “e” object might different in each error type.
In order to avoid firing of an event, please wrap those lines of code with in try catch blocks when needed.
The syntax errors can be avoided using the Syntax Check button on the Smartface.
The event argument has the following properties:
The Server Error is a type of error originated from the use of network objects ( XMLHttpRequest ). It's raised whenever network related error occurs, such as timeout, socket layer problems and server error messages. The network objects have their own onServerError events. In these events, the event argument “e” has the following properties by default.
type: It is “Server Error” as a string, maintaining the same behavior in Application.onError.
responseCode: A number value represents the error code. The values between 1-99 are core level socket errors raised by the internal code; the values greater than 99 are the "http" error codes received from the connected server. More information about response codes can be found on "See Also" section of this article.
message: A user friendly error message coming from core level socket errors or the "http"body message received from server based on the value of "responseCode".
A network object which has the onServerError is defined raises the onServerError of its own. If that event is not bound, the event of Application.onError is raised (Having the onServerError set prevents raising the Application.onError method for that network object) . On both events, the event argument is the same also the “this” keyword references the same network object. In most of the cases, in a project the business level server error codes should be handled in the same manner. Using the Application.onError event lifts the burden of writing different event codes for each network object, also providing special behavior for network object if needed. It also provides option to write separate code for errors if needed.
Timeout Error : After running the network object the following event argument can be observed:
Server Status Code Error
Shown as below: