Adds wrapper for error handling to give cleaner error message.