switch class : IsError getter

Description

Returns a value that indicates whether the last execution of the handler finished with the exception.

Syntax

instance.IsError

Arguments

None

Return value

ClassDescription
boolWhether the last execution of the handler finished with the exception.

Sample code

Suppose you have the following class definition.

1:

class handle

2:

open method void LCHandler(dictionary dic)

3:

throw "exception"; // Exception occurs.

4:

endmethod

5:

endclass

Usage of the IsError getter is as follows.

1:

browser b = new browser();

2:

message m;

3:

handle h = new handle();

4:

switch sw = b.LoadCompleted(h,"LCHandler(dictionary)");

5:

sw.StopWithException = false; // Non-stop event handler.

6:

sw.ShowException = false; // No error message dialog.

7:

sw.Start(); // Start event handler.

8:

_br.LoadUrl("https://example.com/", true); // It is synchronously page loading.

9:

sleep slp.

10:

slp.Freeze(10000); // It wait 10sec, the handler will be called and an exception will be thrown.

11:

bool occur = sw.IsError; // It returns true because the handler will throw exception.

Notes

Returns true if the last execution of the handler finished with the exception. Otherwise, returns false.

Links for reference

None.

Copyright © Cooker All rights reserved.