Set the async callback response

@param  {boolean|undefined} passes  Whether validation passed
@param  {string|undefined} message Custom error message
@return {void}
482817
function(passes, message) {
    this.passes = (passes === undefined || passes === true);
    this._customMessage = message;
    this.callback(this.passes, message);
  }
915948
function validateService(res, url, callback) {
  if (debug) {
    console.log('Sending request to: "' + url + '" to validate ticket.');
  }

  fetch(url).then(function(res) {
      if (res.status == 200) {
        return res.text();
      } else {
        console.log('Receive response from cas when validating ticket, but request failed with status code: ' + casRes.statusCode + '!');
        res.status(401).send({
          message: 'Receive response from cas when validating ticket, but request failed with status code: ' + casRes.statusCode + '.'
        });
      }
    })
    .then(function(casBody) {
      if (casBody) {
        if (debug) {
          console.log('Receive response from CAS when validating ticket with status code 200, casBody: ', casBody);
        }

        callback(casBody);
      }
    })
    .catch(function(err) {
      console.log('Receive response from cas when validating ticket, but request failed!');
      console.error(err);
      return res.status(401).send({
        message: 'Receive response from cas when validating ticket, but request failed!',
        error: err
      });
    });

}
985714
function(message) {
          this.assertions.push({ passed: true, message: message })
          if (JSpec.assert) ++JSpec.stats.passes
        }
640008
function (error, response) {
        if (!_.isNull(error)) {
            error = _.createError(error);
        } else if (!_.isNull(response) && (response.status >= 400 || response.status === 0)) {
            error = _.createError(null, response);
            response = null;
        }
        callback(error, response);
    }
926571
function expressResponseError(response, error, message) {
  let errorMessage = "there was an error in the request";
  if(message)
    errorMessage = message
  response.json({ success: false, error: errorMessage });
  console.error(error);
}
664071
public void setErrorCallback(final I_CmsStringArrayCallback callback) {

        if (callback != null) {
            GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {

                public void onUncaughtException(Throwable e) {

                    String[] stack = new String[e.getStackTrace().length];
                    for (int i = 0; i < e.getStackTrace().length; i++) {
                        StackTraceElement stackEl = e.getStackTrace()[i];
                        stack[i] = stackEl.toString();
                    }
                    callback.call(stack);
                }

            });
        } else {
            GWT.setUncaughtExceptionHandler(null);
        }
    }
586588
function onResponse(packet) {

		if (typeof that.callbacks[packet.respond_to] === 'function') {

			try {
				if (packet.data) {
					packet.data = JSON.undry(packet.data);
				}
			} catch (err) {
				console.log('ERROR UNDRYING PACKET:', err);
				return;
			}

			if (packet.noData) {
				that.callbacks[packet.respond_to](packet.err, packet.stream);
			} else if (packet.stream) {
				that.callbacks[packet.respond_to](packet.err, packet.data, packet.stream);
			} else {
				that.callbacks[packet.respond_to](packet.err, packet.data);
			}
		}

		delete that.callbacks[packet.respond_to];
	}
1092072
function(message) {
    if (!_.isObject(message)) {
      message = {
        message: message
      };
    }

    try {
      message = JSON.stringify(_.defaultsDeep({}, message, this.config.defaultProps));
    } catch (e) {
      return this.logger.error('Logmatic - error while parsing log message. Not sending', e);
    }

    if (this.isConnected) {
      this.sendMessage(message);
    } else {
      this.messageBuffer.push(message);
    }
  }
559067
function( code, e, message ) {
		var callback = munit.render.callback;

		// Force a numeric code for the first parameter
		if ( ! munit.isNumber( code ) ) {
			throw new Error( "Numeric code parameter required for munit.exit" );
		}

		// Allow code, message only arguments
		if ( message === undefined && munit.isString( e ) ) {
			message = e;
			e = null;
		}

		// Messaging
		if ( munit.isString( message ) ) {
			munit.color.red( message );
		}

		// Force an error object for callbacks
		if ( ! munit.isError( e ) ) {
			e = new Error( message || 'munit exited' );
		}
		e.code = code;

		// Only print out stack trace on an active process
		if ( munit.render.state !== munit.RENDER_STATE_COMPLETE ) {
			munit.log( e.stack );
		}

		// Callback takes priority
		if ( callback ) {
			munit.render.callback = undefined;
			callback( e, munit );
		}
		// No callback, end the process
		else {
			munit._exit( code );
		}
	}
1092476
async def on_raw_error(self, message):
        
        error = protocol.ServerError(' '.join(message.params))
        await self.on_data_error(error)
517273
function validate(res, result) {
  if (!result) return true;

  var err = new Error('Validation failed');
  try {
    err.errors = result.errors();
  } catch (err) {
    err.errors = [result.validation];
  }
  err.expose = true;
  err.statusCode = 400;
  err.toJSON = function() {
    return {
      message: this.message,
      errors: this.errors,
    };
  };

  res.sf.reply(err);
}
488131
function error (message) {
        for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
        }

        throw new (Function.prototype.bind.apply(Error, [null].concat(['[spyfu-vuex-helpers]: ' + message], args)))();
    }
1096034
function message(worker, task) {
    var callback = worker.queue[task.id]
      , err;

    // Rebuild the Error object so we can pass it to our callbacks
    if (task.err) {
      err = new Error(task.err.message);
      err.stack = task.err.stack;
    }

    // Kill the whole fucking system, we are in a fucked up state and should die
    // badly, so just throw something and have the process.uncaughtException
    // handle it.
    if (!callback) {
      if (err) console.error(err);
      console.error(task);
      throw new Error('Unable to process message from worker, can\'t locate the callback!');
    }

    callback(err, task);
    delete worker.queue[task.id];
  }
646480
function send(message, callback) {
  const suppliedCallback = callback || function () {};
  if (!message) {
    return suppliedCallback(new Error('No message'));
  }
  const requestParams = {
    url: this.webhook,
    body: extend(this.options, { text: message }),
    json: true
  };
  return request.post(requestParams, function (err, res, body) {
    if (err || body !== 'ok') {
      return suppliedCallback(err || new Error(body));
    }
    return suppliedCallback(null, body);
  });
}
1201888
def _wrap_callback_errors(callback, message):
    
    try:
        callback(message)
    except Exception:
        # Note: the likelihood of this failing is extremely low. This just adds
        # a message to a queue, so if this doesn't work the world is in an
        # unrecoverable state and this thread should just bail.
        _LOGGER.exception(
            "Top-level exception occurred in callback while processing a " "message"
        )
        message.nack()
40904
function(id, msg) {
        var q = queues[id];
        // execute failure callback
        if (q.onFailure) {
            var sc=q.scope || q.win;
            q.onFailure.call(sc, _returnData(q, msg));
        }
    }
1019443
function onMessage(message) {
    if (done) return
    if (message.type != "utf8") return sendConnectFailed(wsConn)

    try {
      message = JSON.parse(message.utf8Data)
    }
    catch(err) {
      return sendConnectFailed(wsConn)
    }

    var id  = message.id

    if (message.type != "request") return sendConnectFailed(wsConn)
    if (message.name != "connect") return sendConnectFailed(wsConn)
    if (message.to   != "server") return sendConnectFailed(wsConn)

    var body = message.body || {}

    if (!body.key) return sendConnectFailed(wsConn)

    var session = sessions.getSession(body.key)
    var channel = channels.createChannel(session, wsConn)

    message = {
      type: "response",
      name: "connect",
      from: "server",
      id:   message.id,
      body: null
    }

    wsConn.sendUTF(JSON.stringify(message))
    cleanUp()
  }