implemented ErrorHandler for handling errors from server