Errors/Exceptions in C

Document created by cdnadmin on Jan 25, 2014
Version 1Show Document
  • View in full screen mode
This document was generated from CDN thread

Created by: Zach Seils on 18-07-2013 04:10:39 PM
How will the C bindings raise exceptions, signals and core dumps?

Subject: RE: Errors/Exceptions in C
Replied by: Joseph Clarke on 18-07-2013 04:19:19 PM
Each onePK C function returns an error code integer.  This error code can be fed to onep_strerror to get a textual representation of the error code.  For example:

1rc = onep_element_connect(ne1, cuser, cpass, config, &sh1);
2if (rc != ONEP_OK) {
3    fprintf(stderr, "Failed to connect to NE: '%s' (%d)\n", onep_strerror(rc), rc);
4    exit(1);
If the library does encounter a fatal condition such as a SIGBUS or SIGSEGV that will be raised just as with any other Linux application.  If the system is configured for core dumps and/or gdb is being used to debug the application, it can be used to obtain a backtrace and analyze the crash.