add docs on error handling