If you don’t like what ERROR() returns for a given message,
Then you can change what it returns.
Note: LOCALE call will only alter future errors, it won’t alter the current one.
You can also use a .ENV file to alter many LOCALE() settings all at once.
PROGRAM
MAP
ReplaceErrMessage(LONG xMsgCode, STRING xNewMessage)
END
Q QUEUE
X LONG
END
CODE
Q.X = 42; ADD(Q)
Q.X = 47; GET(Q, Q.X) ; DO ShowErr
ReplaceErrMessage(30,'Did not find it') ; DO ShowErr
Q.X = 47; GET(Q, Q.X) ; DO ShowErr
ShowErr ROUTINE
MESSAGE('ErrorCode()[' & ERRORCODE() & '] Error()['& ERROR() &']')
ReplaceErrMessage PROCEDURE(LONG xMsgCode, STRING xNewMessage)
CODE
LOCALE('CLAMSG'& xMsgCode, xNewMessage)