External interface error handling

Error handling have been updated with setting error codes for exported classes.