Edited error handler.