en:onerror [BASIC 256 - Language Documentation]

# BASIC 256 - Language Documentation

en:onerror

## OnError (Statement)

### Format

onerror label

### Description

Causes the Gosub at label to be executed or Subroutine to be called when an runtime error occurs. Program control may be resumed at the next statement with a Return statement in the subroutine. Error traps are kept in a stack so that the last defined trap, that has not been removed with an OffError will be the active one.

You may not execute an OnError statement inside a Try / Catch / End Try statement.

### Example

See example of usage on Error Codes and ThrowError pages.

### See Also

Lasterror, Lasterrorextra, Lasterrorline, Lasterrormessage, Offerror, Onerror, ThrowError, Try / Catch / EndTry

### History

0.9.6z | New To Version

en/onerror.txt · Last modified: 2014/02/08 12:26 by admin