add the overrided write_error to base handler