Changed an error handler from when to set/catch