Sys.Debug fail Method
Displays a message in the debugger's output window and breaks into the debugger.
The fail method should be used to catch developer errors. To respond to user errors and run-time error conditions such as network errors or permissions failures, throw an exception.
Debugging behavior, requirements, and the output of trace messages vary with different browsers. For more information, see Debugging and Tracing Ajax Applications Overview
The following example shows a function that fails if the user-defined variable n is not set to a numeric value. This is part of a larger example from the Sys.Debug class overview.