How to set up a "silent" error?
I like Application Error Log a lot, both for its full stack and a big list of variables. I'd like to "hack" this functionality and record the same in this log when a certain variable has a certain value. This quasi error should not be visible to the user, and it should not interrupt the application flow. Is that possible?
Throwing an error in a try-catch block does not record the error, tested. I am considering recording variables and the stack differently, I know how to do both, but that would miss the nice Application Error Log functionality.
Upd: I got an immediate DC AI Bot reply. Offhand seems reasonable :-)
Comments
if <your condition> do LOG^%ETNLooks slightly unusual but fully functional. Thanks!
You can log the exception in your catch block for exactly the result you're looking for, if I understand your request correctly.
try{
//Your code here.
}
catch ex{
//The below line will add the exception to the application error log.//Code will continue to execute after the catch block.do ex.Log()
}Very good and customizable
TRY {
s ex= ##class(%Exception.General).%New("test",1,data1,data2)
throw ex}
CATCH ex {
d ex.Log()
}
You can call directly to: Do BACK^%ETN it will save the $ZE + the stack. (LOG is also calling this one)