Question
· Feb 20, 2018

Working with ByRef errorlog from $System.OBJ

Several $System.OBJ methods have ByRef errorlog argument:

Compile(ByRef classes As %String = "", qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean = 0)

ImportDir(dir As %String = "", wildcards As %String, qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean = 0, ByRef imported As %String, listonly As %Boolean, ByRef selectedlist As %String)

What's the best approach of working with errorlog?

Do you convert it to status? If so - how? Manual iteration over local?

Is there some system method to convert it into %Status?

Sample errorlog:

do $system.OBJ.ImportDir(,,, .errorlog)
zw errorlog
errorlog=1
errorlog(1)="ERROR #5009: Directory name is required [zImportDir+1^%SYSTEM.OBJ.1:GITLAB]"
errorlog(1,"caller")="zImportDir+1^%SYSTEM.OBJ.1"
errorlog(1,"code")=5009
errorlog(1,"dcode")=5009
errorlog(1,"domain")="%ObjectErrors"
errorlog(1,"namespace")="GITLAB"
errorlog(1,"param")=0
errorlog(1,"stack")=$lb("e^zImportDir+1^%SYSTEM.OBJ.1^1","d^^^0")
Discussion (1)1
Log in or sign up to continue

I don't know the answer to your question--whats the best approach for working with errorlog, but...

The %Status returned from the Compile() method only contains the first error status (of what could be a large number of errors). errorlog contains the result equivalent to calling $SYSTEM.Status.DecomposeStatus() on all the errors encountered while compiling.

errorlog is cumulative. If you call Compile() or similar methods multiple times passing the same errorlog variable, you end up with the decomposed results from all of the calls.

You could iterate over errorlog and re-compose a set of %Status values, but you already have the (single) %Status returned from Compile()