JavaScript error -throw, try and catch

try error test code block statements.

catch statement handles the error.

throw statement creates custom error.

finally statement after the try and catch statements, regardless of whether an exception is triggered, the statement will be executed.

JavaScript throw (throw) error

When an error occurs, when things go wrong, JavaScript engines usually stop and generate an error message.

Technical term used to describe this is: JavaScript will throw an error.

JavaScript try 和 catch

try statement allows us to define the code block error test at the time of execution.

catch statement allows us to define a block of code when an error occurs when the try block, performed.

JavaScript statement to try and catch in pairs.

finally statement that there is no error will be executed.

Throw Statement

throw statement allows us to create custom error.

The correct technical term is: create or throws an exception (exception).

If used with a try to throw and catch, you can control program flow and generate a custom error messages.

Note: The catch here is that we seize the self-righteous given (throw) exception information.

 

 

Guess you like

Origin www.cnblogs.com/1016391912pm/p/11799760.html