How to set $$$envCallerErrorInfoGet on windows to get the location information within a exception.

Class documentation:

class %Exception.General extends AbstractException

Simple exception class that can be throw in user code. You can throw this with code similar to:

	Throw ##class(%Exception.General).%New(name,numericCode,location,data)

The name is a string name for the exception, the numericCode is a numeric error code. If the location field is blank and $$$envCallerErrorInfo is defined then the system will attempt to fill in this location where the exception was thrown from automatically. You can pass additional exception data in the data argument.

 

Does any boding knows how to set the  $$$envCallerErrorInfo variable? Ensemble is running on Windows PC.

  • 0
  • 0
  • 143
  • 0
  • 1

Answers

System-wide:

Set ^%oddENV("callererrorinfo")=1

Or for the current namespace:

Set ^%oddENV("callererrorinfo",$namespace)=1

For more information, see macro definitions in %occEnvironment.inc. 

You can also set this global to 2 instead of 1, which has the side effect of including a full stack trace when a %Status is converted to a human-readable string (e.g., via $System.Status.GetErrorText()). This is handy for debugging, but probably not something to use on a production system (since it could end up exposing more information about your code than you'd really want).