switch class : ErrorMessages getter

Description

Returns a list of error messages that occurred in the previous execution of the handler.

Syntax

instance.ErrorMessages

Arguments

None

Return value

ClassDescription
List{string}A list of error messages that occurred in the previous execution of the handler.

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 ErrorMessages 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:

m.Show(sw.ErrorMessages); // It show error-messages.

Notes

Returns a list of error messages of the exception that was not caught by a try statement among the exceptions that occurred during the previous execution of the handler.

The empty list is returned if all of the exception is caught by the try statement or the handler execution is successfully completed.

Links for reference

None.

Copyright © Cooker All rights reserved.