02.05.2013 Views

MKS Integrity 2007 Integrations Builder Guide

MKS Integrity 2007 Integrations Builder Guide

MKS Integrity 2007 Integrations Builder Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: Using the <strong>MKS</strong> API<br />

34<br />

Some C API functions return NULL if an error has occurred, rather than an error code. For<br />

these functions, you need to retrieve the error code in a different way.<br />

For functions that return pointers to structs, like mksCmdRunnerGetSession(),<br />

mksSessionGetIntegrationPoint(), mksCmdRunnerExecCmd(), and<br />

mksCmdRunnerExecArr, use the mksGetError()function to retrieve the last generated<br />

error, and the mksAPIStrError() function to retrieve the error message for the related error<br />

code, for example:<br />

mksResponse response = NULL;<br />

response = mksCmdRunnerExecCmd(cr, cmd, NO_INTERIM);<br />

if (response == NULL) {<br />

rtn = mksGetError();<br />

/* Handle the error here. */<br />

}<br />

NOTE The return value of mksGetError() is only updated after making a call to a<br />

function that does not return mkstrn or void. For example, calling<br />

mksResultGetMessage() after calling mksResultGetField() does not reset<br />

the return value of mksGetError() as was set by the mksResultGetField()<br />

function.<br />

For the remaining functions that return NULL, use the mksGetError() function to retrieve<br />

the mksrtn error code value, and the mksAPIStrError() function to retrieve the string<br />

associated with the error.<br />

Application Error Codes<br />

The application error codes represent only the generic application exceptions. There are<br />

many more specific exceptions that are possible within each generic application exception.<br />

Each specific exception is mapped to an exported exception name used for API exception<br />

reporting. The specific exception that occurred can be identified using the<br />

mksAPIExceptionGetId() method.<br />

The following tables list the application error codes that can occur, what they mean, and the<br />

reason why they occur.<br />

Error<br />

Code<br />

Description Reason for Error<br />

300 General application exception Processing or validation error within <strong>MKS</strong> <strong>Integrity</strong><br />

or <strong>MKS</strong> Source.<br />

301 Unsupported application Application passed in with command is unknown/<br />

invalid.<br />

302 Internal application error Internal error occurred on integration point while<br />

executing command.<br />

303 No such element error Attempted to access element that does not exist,<br />

for example, field.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!