Arbortext Command Language > Repository API > Error Message Handling in the Repository API
  
Error Message Handling in the Repository API
Most non-Repository API ACL functions write error messages to the global variable $ERROR . The functions in the Repository API do not behave the same way. If a Repository API function returns an error state (usually -1), the developer should include code to obtain the error text from main::ioerr variable. If the main::ioerr variable contains a value of -183, then the developer should invoke the sess_err_message function to retrieve the text for the session error that the Repository API function generated.
A sample of such code appears below.
# The dobj_lock() function is used for this example.
#
$ret = dobj_lock(..)
#
# Test for errors, values less than zero are errors.
#
if ($ret <=0)
{
#
# Retrieve the error code from main::ioerr.
#
local err_code = main::ioerr;
#
# If the error code is -183, retrieve the session error
# text using the sess_err_message function. Otherwise,
# retrieve the error text from the dms::io_err_msg array
# using the error code as the index into the array.
#
if (err_code == -183)
{
err_message = sess_err_message(sesshdl);
}
else
{
err_message = dms::io_err_msg[err_code]
}
}
Related Topics
sess_err_message function