If error happend in the Alinous-Script, the exception will thrown. Then you can use try-catch-finally block.
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.
The exception is DOM variable. By watching debugger, it is shown like below.
The exception itself's value is type of exception. And it has child element named "message".
If an exception occurs in the try block. The catch block catches the exception. In this block, you can write error handling code.
The throw sentence can make exception rise. In this code, we throw catched exception, but you can also make DOM variable and throw it.
The finally block is executed everytime. In this code, this block is executed after the exception is thrown.