Lasso Soft Inc. > Home

[ Error_Code ]

Method

The [Error_Code] method returns the current error code. Lasso keeps track of one error code which can be set by any tag. Calling [Error_Msg] and [Error_Code] immediately after calling certain methods will display information about any errors that were experienced by the method. The error code and message will remain until they are reset by another method call. Note: This method returns the same value as [Error_CurrentError(-ErrorCode)].

  • Syntax
Error_Code

Error_Code(1234)
Examples
  • Intermediate

When designing methods and types it can at times be handy to let the method start with a clean slate Thus it won't be affected by possible errors that occurred before calling the method. But once the method is done it's important to restore the errors to the previous value so that they can be dealt with in a proper manner. Since error_code (and error_msg) can be set by code it is easy to accomplice this.

Code

define my_method(...) => {

	local(store_errorcode = error_code)
	local(store_errormsg = error_msg)
	error_reset

	// Some method code here
	if(error_code) => { // this will only be triggered by errors produced inside the method
		// Do something relevant
	}
	// More method code

	error_code = #store_errorcode
	error_msg = #store_errormsg

	return 'Whatever's relevant for the method'

}

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft