Question
· Aug 11, 2020

How to obtain low (OS) level error description in Cache ObjectScript?

Sometimes standard COS methods fails and returns low level error code (like %File(CopyFile) error code "-3").

As per ISC Support response, Cache is negating low level error codes (adding "-" prefix).

Is there any existing COS method or COS code snippet to obtain low level error description based on low level error code (positive or negative)? 

Discussion (5)2
Log in or sign up to continue

I wouldn't recommend using ZU commands as they are deprecated so they are not guaranteed to always work.

Errors returned can occasionally be COS error codes, or they might boil down to OS error codes. It depends on the function; I don't know if there's a universal method that differentiates. I think you need to look at what you're calling. Often the class reference gives details on what error codes to expect.

In your particular case, referring to the %Library.File.CopyFile class reference:

"This method returns true if it succeeds and false otherwise. Pass return by reference to obtain the low level return value in case of errors which is the negative value of the operating system return code."