# ON ERROR GOTO > [HTML Version](onerrorgoto.htm) _Written July 2020_ **ON ERROR GOTO ** **ON ERROR GOTO** ON ERROR GOTO establishes the specified label as an error trap, such that the runtime system redirects to that location when an ASB error is detected. The error trap routine should then handle any appropriate error recovery activities such as logging, reporting and/or determining what to do next. In order to clear the error and resume operation of the program, see the RESUME statement. ON ERROR GOTO without any label effectively disables the error trap. When there is no error defined, the default response to an error is to abort the program and output a message to the screen giving the error number, last file, and last location. **Example** ON ERROR GOTO TRAP ... START: ... TRAP: ? "Error ";ERR(0) IF ERR(0) = 1 THEN \! if ^C ... RESUME START \! resume at START label ELSE CHAIN "MAIN" \! else chain to main menu ENDIF **See Also** • [ERR](err_system_def.htm.md) function • [RESUME](resume_ctrl_stmt.htm.md) • [Xcall ERRMSG](errmsgsbr.htm.md) • [Xcall FILNAM](filnamsbr.htm.md) • [Error Trapping in Functions](errortrappinginfunctions.htm.md) • [Error Trapping](errortrapping_sbx.htm.md) in SBX routines