Enable $$$GeneralError Macro
I am testing application code and want to simulate error conditions.
I am trying to use the following to define a custom error with a class method.
$SYSTEM.Status.Error($$$GeneralError,"Any text here")
My class method code looks like this....
Class compile fails because the $$$GeneralError is unknown.
TEXT: set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")
I expect I need to include something to enable the Macro.
Any suggestions are apprecated.
I believe that you need to include %occErrors in your macro source code.
#include %occErrors
should take care of it.
I got something working using logic like this.....
set RunStatus=$System.Status.Error(5001,"DXL Testing Run Error")
The correct way to do this is:
set RunStatus=$System.Status.Error($$$ERRORCODE($$$GeneralError),"DXL Testing Run Error")
So use $$$ERRORCODE which can convert the error code to the number correctly.
Unless I've misunderstood the context, it's simpler to use the ERROR macro:
You don't need %occErrors.inc to get GeneralError, because of how ERROR (like ERRORCODE) is defined.
You are right, I had missed this was creating a %Status and thought they just needed the error code. To create a %Status value I would always use the $$$ERROR macro as you suggest.