/*
error

Flashes a red error message.
Parameters:
view: 'login' or 'list': which view is the user on? Determines which DOM element is used to show the error.
message: The message to display, pulled straight from the CloudMine server response.
545406
function(view, message){
      $('#error_' + view).css({display: 'inline-block'}).text('Error! ' + message);
      setTimeout(function(){
        $('#error_' + view).fadeOut(500);
      }, 3500);
    }
440603
function extractError(response, request) {

	var result,
	    entry,
	    req,
	    i;

	response = Blast.Bound.Array.cast(response);
	request = Blast.Bound.Array.cast(request);

	for (i = 0; i < response.length; i++) {
		entry = response[i];

		if (entry.error) {
			req = request[i] || {};
			result = new Error('Error in "' + req.type + '" command: ' + entry.error);
			result.type = req.type;
			result.vbmsg = entry.error;
			result.req = req;
			break;
		}
	}

	if (result) {
		result.original_response = response;
	}

	return result;
}
703994
def error_messages
      self.errors.map do |e|
        msg = nil
        if e
          msg = e[:text]
          msg += ": #{e[:fieldName]}" unless e[:fieldName].blank?
        end
        msg
      end
    end
20970
def fail(self, message, view, type_error=False):
        
        exc_class = ConfigTypeError if type_error else ConfigValueError
        raise exc_class(
            u'{0}: {1}'.format(view.name, message)
        )
1301279
public static function __error($message = 'View error', $file = null, $line = null)
    {
        if (!is_null($file)) {
            $message .= sprintf(' in file "%s"', $file);
            if (!is_null($line)) {
                $message .= sprintf(' at line %s', $line);
            }
        }
        trigger_error($message, E_USER_WARNING);
    }
932119
function (form) {
            var viewData = {
              form: form,
              organization: req.organization
            };
            // The form library puts us in this error case if the form is empty,
            // which is true when you arrive on the form with a GET request.
            // This conditional allows us to control what we do in that situation
            if (form.data && !form.data.email) {
              client.getCurrentTenant(function (err, tenant) {
                if (err) {
                  logger.info(err.message);
                  viewData.error = err.userMessage;
                  return helpers.render(req, res, view, viewData);
                }

                tenant.verifyAccountEmail(req.query.sptoken, function (err, account) {
                  if (err) {
                    logger.info(err.message);
                    viewData.invalid_sp_token = true;
                    return helpers.render(req, res, view, viewData);
                  }

                  client.getAccount(account.href, function (err) {
                    if (err) {
                      logger.info(err.message);
                      viewData.error = err.userMessage;
                      return helpers.render(req, res, view, viewData);
                    }

                    res.redirect(config.web.login.uri + '?status=verified');
                  });
                });
              });
            } else {
              viewData.formErrors = helpers.collectFormErrors(form);
              helpers.render(req, res, view, viewData);
            }
          }
16511
function(message) {

    // If an error already has been thrown, exit
    if (errorTarget) return message

    utils.doCallback('errorTriggered', message);
    utils.logError(message)

    // If no target DOM element exists, only do the logging
    if (!rootTarget) return message

    var messageProcessed = message
    var contextProcessed = null

    if (utils.isArray(message)) {
      messageProcessed = message[0]
      if (message[1].data) {
        contextProcessed = stringify(message[1].data.errors || message[1].data.error || message[1].data)
      } else {
        contextProcessed = stringify(message[1])
      }
    }

    var template = require('./templates/error.html');
    errorTarget = $(template.render({
      errorWarningIcon: require('!svg-inline!./assets/error-warning-icon.svg'),
      message: messageProcessed,
      context: contextProcessed
    }));

    rootTarget.append(errorTarget);

    return message

  }
1252259
def error(message = nil, &block)
      logger.add(Logger::ERROR, message, self.logging_prefix, &block)
    end
676364
function error() {
    var _console3;

    if (LatticeLogs.failFast(LatticeLogs.ERROR)) return;

    for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
      args[_key5] = arguments[_key5];
    }

    (_console3 = console).error.apply(_console3, (0, _toConsumableArray2.default)(args.map(LatticeLogs.argMapper)));
  }
576996
function (err, result) {

		// if login is successful, we record the user's account in cache
		if (err) {
			LOG.warn(err.toString());
			result = {code: err.code, msg: err.message};
		}
		else {
			if (result.code === 0) {
				LOG.warn('login success, result: ');
				LOG.warn(result);

				var data = {
					account: user_data.account,
					groups: result.data.groups,
					lastStatus: result.data.lastStatus,
					permissions: []
				}
				
				l_initSession(event.data.login_id, event.session, data);

				/*
				// todo: read permssion from DB
				//event.session['_permissions'] = result.data.permissions;
				var xx = [];
				var onSuccess = function(dat){
					//console.log(dat.permission);
					if (dat === null) {
						console.log("no permission");
					}
					else {
						for (var i in dat.permission) {
							//console.log("pushing: " + dat.permission[i]);
							xx.push(dat.permission[i]);
						}
					}
					//event.done("get group", {"status": "success", "data": data});
				};
				var onFail = function(dat){
					//event.done("get group", {"status": "failure", "data": data});
				};
				for (var i in event.session['_groups']) {
					//console.log("getting: " + event.session['_groups'][i]);
					SR.DB.getData(groupPermissionDB, {"group": event.session['_groups'][i], part: "group"}, onSuccess, onFail);
				}
				*/
				
				// TODO: login at once to all local accounts
				// NOTE: need to query all local login account name & password, then perform individual logins
				l_login_local_accounts(user_data.account);			
			}
		}

		//LOG.warn('event before sending login response:');
		//LOG.warn(event);
		
		//if (result.data) delete result.data;
		// return response regardless success or fail
		event.done('SR_LOGIN_RESPONSE', result);
	}
256543
function (err, data) {
		if (err) {
			LOG.warn(err.toString());
		}
		else {
			for (var server in data.accounts) {
				LOG.warn('local server: ' + server);

				var user_list = data.accounts[server];
				for (var uid in user_list) {
					var token = user_list[uid];
					LOG.warn('local uid: ' + uid + ' token: ' + token);
					l_send_remote_login(server, uid, token);	
				}
			}
		}
	}
1098966
function on_error(e) {
	console.log('problem with request: ' + e.message);
	var response = new anchor._response_handler(null);
	response.okay(false);
	response.message(e.message);
	response.message_type('error');
	anchor.apply_callbacks('error', [response, anchor]);
    }
970692
function ErrorMessage({ state, error, clearError }) {
  return (
    <>
      <h1 style={{ color: "red" }}>{error.message}</h1>
      <button onClick={() => clearError()}>Try Again</button>
      <pre>{JSON.stringify(state, null, 2)}</pre>
    </>
  )
}
1163908
function(error) {
    // Ignore error if cancelled by the client.
    if (error['name'] && error['name'] == 'cancel') {
      return;
    }
    // Check if the error was due to an expired credential.
    // This may happen in the email mismatch case where the user waits more
    // than an hour and then proceeds to sign in with the expired credential.
    // Display the relevant error message in this case and return the user to
    // the sign-in start page.
    if (firebaseui.auth.widget.handler.common.isCredentialExpired(error)) {
      var container = component.getContainer();
      // Dispose any existing component.
      component.dispose();
      // Call widget sign-in start handler with the expired credential error.
      firebaseui.auth.widget.handler.common.handleSignInStart(
          app,
          container,
          undefined,
          firebaseui.auth.soy2.strings.errorExpiredCredential().toString());
    } else {
      var errorMessage = (error && error['message']) || '';
      if (error['code']) {
        // Firebase Auth error.
        // Errors thrown by anonymous upgrade should not be displayed in
        // info bar.
        if (error['code'] == 'auth/email-already-in-use' ||
            error['code'] == 'auth/credential-already-in-use') {
          return;
        }
        errorMessage =
            firebaseui.auth.widget.handler.common.getErrorMessage(error);
      }
      // Show error message in the info bar.
      component.showInfoBar(errorMessage);
    }
  }
600446
def use_response_error_message?(request, response)
      if (request.path.include?('/data/') && !response.content_type.nil?)
        response.content_type.include? 'text/plain'
      else
        false
      end
    end
718739
function(params, callback) {
        /**
         * Callback for QB.chat.message.list()
         * @param {Object} error - The error object
         * @param {Object} messages - The messages object.
         * @callback listMessageCallback
         * */

        this.service.ajax({
            url: Utils.getUrl(MESSAGES_API_URL),
            data: params
        }, callback);
    }
1363051
def error_output(self, message, method_affected=None):
        
        color_fn = self._py3_wrapper.get_config_attribute
        color = color_fn(self.module_full_name, "color_error")
        if hasattr(color, "none_setting"):
            color = color_fn(self.module_full_name, "color_bad")
        if hasattr(color, "none_setting"):
            color = None

        error = {
            "full_text": message,
            "color": color,
            "instance": self.module_inst,
            "name": self.module_name,
        }
        for method in self.methods.values():
            if method_affected and method["method"] != method_affected:
                continue

            method["last_output"] = [error]

        self.allow_config_clicks = False
        self.set_updated()