Ok, I upgraded errors, so they verbose on demand. now:

USER>s sc=##class(shvarov.objectscript.errors).DIVIDE()

USER>zw sc

sc="0 "_$lb($lb(5002,"<DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1",,,,,,,,$lb(,"USER",$lb("^DIVIDE+3^shvarov.objectscript.errors.1^1","e^^^0"))))/* ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1 */

USER>s status.sc=##class(shvarov.objectscript.errors).DIVIDE()

ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1

USER>

So, every time I need to printout an error I do:

USER>set status.sc=##class(bla.bla).method()

and it prints out an error if it is an error. and if not it is silent?

I like it!

Well done, @David Hockenbroch !

USER>zpm "install watchedstatus"

[USER|watchedstatus] Reload START (/usr/irissys/mgr/.modules/USER/watchedstatus/1.0.3/)

[USER|watchedstatus] Reload SUCCESS

[watchedstatus] Module object refreshed.

[USER|watchedstatus] Validate START

[USER|watchedstatus] Validate SUCCESS

[USER|watchedstatus] Compile START

[USER|watchedstatus] Compile SUCCESS

[USER|watchedstatus] Activate START

[USER|watchedstatus] Configure START

[USER|watchedstatus] Configure SUCCESS

[USER|watchedstatus] Activate SUCCESS

Installed perfectly!

Not sure about functionality though. I was wondering of a class that gives me an error, and remember another ipm module - objectcript-errors.

Installed:

USER>zpm "install objectscript-errors"

[USER|objectscript-errors] Reload START (/usr/irissys/mgr/.modules/USER/objectscript-errors/1.0.2/)

[USER|objectscript-errors] Reload SUCCESS

[objectscript-errors] Module object refreshed.

[USER|objectscript-errors] Validate START

[USER|objectscript-errors] Validate SUCCESS

[USER|objectscript-errors] Compile START

[USER|objectscript-errors] Compile SUCCESS

[USER|objectscript-errors] Activate START

[USER|objectscript-errors] Configure START

[USER|objectscript-errors] Configure SUCCESS

[USER|objectscript-errors] Activate SUCCESS

it can generate errors in simple objectscript calls, e.g. null division etc:

USER>s sc=##class(shvarov.objectscript.errors).DIVIDE()         

ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1

USER>zw sc

sc="0 "_$lb($lb(5002,"<DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1",,,,,,,,$lb(,"USER",$lb("^DIVIDE+3^shvarov.objectscript.errors.1^1","e^^^0"))))/* ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1 */

So this is what I did:

USER>set status=##class(DH.WatchedStatus).New("RW")

USER>set status.sc=##class(shvarov.objectscript.errors).DIVIDE()

ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1ERROR #5002: ObjectScript error: <DIVIDE>DIVIDE+3^shvarov.objectscript.errors.1

if I do w status.sc:

USER>w status.sc

1

If I do everything right?