Handling exceptions and errors from C callbacks.