Add basic error handling.

@reiddraper