adding error handling

some callbacks will now have to pass and accept an extra 'err'
argument
Merge pull request #1 from marcelog/marcelog_error_handling

adding error handling