Add basic error handling

Handle errors, by catching and logging error to console