The example is in your article:

Class petstoreserver.impl Extends %REST.Impl [ ProcedureBlock ] { Parameter ExposeServerExceptions = 1; 
/// Service implemntation for post /pet 
ClassMethod addPet(messageRequest As petstoreserver.requests.addPet) As %Status
{ ; Implement your service here. 
  ; Return {} 
 $$$ThrowStatus($$$ERROR($$$NotImplemented)) 
    
} ... }

The declaration returns %Status.

The generated stub suggests return {} meaning the method should return json (which is true)

and below it throws status.

I think nothing can be fixed here :) Do we have any datatype to provide meaning that we expect the method to return JSON? %JSON? ))

But this discrepancy is quite confusing when you look at it for the first time.

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!