9.8 Errors object

Description

You can enable/disable all error messages with the Error object. Additionally you control the error handling.

List of methods/properties

NameTypeShort description
EnableMethodEnables the error message output system
DisableMethodDisables the error message output system
ResumeMethodAdmits multi-line DestinyScripts to continue on errors
HaltMethodAdmits multi-line DestinyScript to abort on errors
CatchMethodReturns the number of the last occured error

Enable

Description

Enables the error message output system. This has no effect on the single disabled errors via the Error object (this means if an error occurs and it has been disabled with the Error object then there won't be any error message shown).

Syntax

1
Errors.Enable()

Return value

None

Type

Method

Example

1
2
$
Errors.Enable()
At the end error messages whould be shown if necessary (= default option).

Disable

Description

Disables the error message output system. All error messages will be suppressed. This happens even if single errors have been enabled using the Error object.

Syntax

1
Errors.Disable()

Return value

None

Type

Method

Example

1
2
$
Errors.Disable()
At the end no error messages whould be shown.

Resume

Description

If you call this method then multi-line DestinyScripts will continue running if an error occurs.

Syntax

1
Errors.Resume()

Return value

None

Type

Method

Example

1
2
3
4
5
$
v[1] = 0;
Errors.Resume();
v[2] = 5 / 0;
v[1] = 5
v[1] whould be at end: 5 (the line 4 raises a "Division by zero" error. The following lines will still be executed!)

Halt

Description

If you call this method then multi-line DestinyScripts will abort if an error occurs (= default option).

Syntax

1
Errors.Halt()

Return value

None

Type

Method

Example

1
2
3
4
5
$
v[1] = 0;
Errors.Halt();
v[2] = 5 / 0;
v[1] = 5
v[1] whould be at end: 0 (the line 4 raises a "Division by zero" error. So the following lines won't be executed!)

Catch

Description

This method returns the number of the last occured error. If no error has occured the return value is 0. After a query of this method the number of the last occured error will be reset to 0. If an unknown error occured the return value is -1 (this differs from ERROR_UNKNOWN which has the value 0).

Syntax

1
Errors.Catch()

Return value

Dword

Type

Method

Example

In this example two DestinyScripts will run serially, but in two different RPG-Maker comments.
1
2
$
v[2] /= 0
1
2
$
v[1] = Errors.Catch()
v[1] whould be at end: 15 (this is the error number of the "Division by zero" number)