DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing a SCOadmin manager

Checking for errors

When making an object call you should always check for errors. Generally an object call will return a single BMIP response. Here is an example of processing a single BMIP response from an object get call and handling any errors:

   set objcall [list ObjectGet {sco user} \
       {{{systemId colossus} charlesf}} pw_dir]
   

set bmipResponse [SaMakeObjectCall $objcall]

set firstBmip [lindex $bmipResponse 0] set errStack [BmipResponseErrorStack firstBmip]

if { ![lempty $errStack] } { ErrorPush errStack 1 SCO_GUIERR_ERR_GET_PWD } else { set attrs [BmipResponseAttrValList firstBmip] set pwd [keylget attrs pw_dir] }

Here is a similar example, but when multiple BMIP responses are expected:
   set objcall [list ObjectGet -scope 1 {sco user} \
       {{{systemId colossus} charlesf}} pw_dir]
   

set bmipResponse [SaMakeObjectCall $objcall]

foreach bmip $bmipResponse { set errStack [BmipResponseErrorStack bmip] if { ![lempty $errStack] } { ErrorPush errStack 1 SCO_GUIAPP_ERR_GET_USERS } else { set object [BmipResponseObjectInstance bmip] set attrs [BmipResponseAttrValList bmip] keylset userlist $object [keylget attrs pw_name] } }

Here is an example of an action object call with no expected BMIP response if the action is successful:
   set objcall [list ObjectAction {sco user} \
       {{{systemId colossus} charlesf}} setPassword $passwd]
   

set bmipResponse [SaMakeObjectCall $objcall]

set firstBmip [lindex $bmipResponse 0] set errStack [BmipResponseErrorStack firstBmip]

if { ![lempty $errStack] } { ErrorPush errStack 1 SCO_GUIERR_ERR_CHANGE_PASSWORD }


Next topic: Object definitions and attributes
Previous topic: Object call example

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005