Error handling

Platform LSF API uses error numbers to indicate an error. There are two global variables that are accessible from the application. These variables are used in exactly the same way UNIX system call error number variable errno is used. The error number should only be tested when an LSLIB or LSBLIB call fails.

lserrno

An Platform LSF program should test whether an LSLIB call is successful or not by checking the return value of the call instead of lserrno.

When any LSLIB function call fails, it sets the global variable lserrno to indicate the cause of the error. The programmer can either call ls_perror() to print the error message explicitly to the stderr, or call ls_sysmsg() to get the error message string corresponding to the current value of lserrno.

Possible values of lserrno are defined in lsf.h.

lsberrno

This variable is very similar to lserrno except that it is set by LSBLIB whenever an LSBLIB call fails. Programmers can either call lsb_perror() to find out why an LSBLIB call failed or use lsb_sysmsg() to get the error message corresponding to the current value of lsberrno.

Possible values of lsberrno are defined in lsbatch.h.

Tip:

lserrno should be checked only if an LSLIB call fails. If an LSBLIB call fails, then lsberrno should be checked .