Error handling

 If error happend in the Alinous-Script, the exception will thrown. Then you can use try-catch-finally block.

Example of exception

 Please taka a look at the code below at first.

 At line 2, an exception is thrown. And after that, the exception will handled by catch and filanny block.

Exception

 The exception is DOM variable. By watching debugger, it is shown like below.

Thrown exception

The exception itself's value is type of exception. And it has child element named "message".

catch block

 If an exception occurs in the try block. The catch block catches the exception. In this block, you can write error handling code.

throw

 The throw sentence can make exception rise. In this code, we throw catched exception, but you can also make DOM variable and throw it.

finally

 The finally block is executed everytime. In this code, this block is executed after the exception is thrown.


Go to Top