Provides error handling for DeviceAdmin send_message and
        send_bulk_message methods.
515286
def send_messages(self, request, queryset, bulk=False, data=False):
        
        ret = []
        errors = []
        total_failure = 0

        for device in queryset:
            if bulk:
                if data:
                    response = queryset.send_message(
                        data={"Nick": "Mario"}
                    )
                else:
                    response = queryset.send_message(
                        title="Test notification",
                        body="Test bulk notification"
                    )
            else:
                if data:
                    response = device.send_message(data={"Nick": "Mario"})
                else:
                    response = device.send_message(
                        title="Test notification",
                        body="Test single notification"
                    )
            if response:
                ret.append(response)

            failure = int(response['failure'])
            total_failure += failure
            errors.append(str(response))

            if bulk:
                break

        if ret:
            if errors:
                msg = _("Some messages were sent: %s" % (ret))
            else:
                msg = _("All messages were sent: %s" % (ret))
            self.message_user(request, msg)

        if total_failure > 0:
            self.message_user(
                request,
                _("Some messages failed to send. %d devices were marked as "
                  "inactive." % total_failure),
                level=messages.WARNING
            )
23495
function onError (error) {
  switch (error.code) {
    case 'EACCES':
      throw new InternalServerError(error, 'Port require elevated privileges')
    case 'EADDRINUSE':
      throw new InternalServerError(error, 'Port is already in use')
    default:
      throw new InternalServerError(error, error.message)
  }
}
243003
function sendError (
  event, message, recordName, socketWrapper, onError, options, context, metaData
) {
  options.logger.error(event, message, metaData)
  if (socketWrapper) {
    socketWrapper.sendError(C.TOPIC.RECORD, event, message)
  }
  if (onError) {
    onError.call(context, event, message, recordName, socketWrapper)
  }
}
472108
public function triggerError($error_message = null, $error_type = null) {

        if ($error_message !== null && $error_type !== null) {
            trigger_error($error_message, $error_type);
        }
    }
1066051
function sendError(error, params) {
    checkParams(params);
    
    params.status = FILE_NOT_FOUND;
    
    const data = error.message || String(error);
    
    logError(error.stack);
    
    send(data, params);
}
47435
def error_handler(self, e, request, meth, em_format):
        
        if isinstance(e, FormValidationError):
            return self.form_validation_response(e)

        elif isinstance(e, TypeError):
            result = rc.BAD_REQUEST
            hm = HandlerMethod(meth)
            sig = hm.signature

            msg = 'Method signature does not match.\n\n'

            if sig:
                msg += 'Signature should be: %s' % sig
            else:
                msg += 'Resource does not expect any parameters.'

            if self.display_errors:
                msg += '\n\nException was: %s' % str(e)

            result.content = format_error(msg)
            return result
        elif isinstance(e, Http404):
            return rc.NOT_FOUND

        elif isinstance(e, HttpStatusCode):
            return e.response
 
        else: 
            """
            On errors (like code errors), we'd like to be able to
            give crash reports to both admins and also the calling
            user. There's two setting parameters for this:

            Parameters::
             - `PISTON_EMAIL_ERRORS`: Will send a Django formatted
               error email to people in `settings.ADMINS`.
             - `PISTON_DISPLAY_ERRORS`: Will return a simple traceback
               to the caller, so he can tell you what error they got.

            If `PISTON_DISPLAY_ERRORS` is not enabled, the caller will
            receive a basic "500 Internal Server Error" message.
            """
            exc_type, exc_value, tb = sys.exc_info()
            rep = ExceptionReporter(request, exc_type, exc_value, tb.tb_next)
            if self.email_errors:
                self.email_exception(rep)
            if self.display_errors:
                return HttpResponseServerError(
                    format_error('\n'.join(rep.format_exception())))
            else:
                raise
1167718
def regular_error_handling?(ex) #:nodoc:
      if @error_block 
        return true if (ex.respond_to?(:exit_code) && ex.exit_code == 0)
        @error_block.call(ex)
      else
        true
      end
    end
776345
def errorhandle(self, resp):            
        """"""
        if self.format == 'json':
            parsed = xmltodict.parse(resp)
            errors = parsed[self.RESPONSE_TOKEN][self.ERROR_TOKEN]
            # Create list of errors if more than one error response is given
            if type(errors) is list and len(errors) > 1:
                messages = ", ".join([" ".join(["{}: {}".format(k,v) for k, v in e.items()]) for e in errors])
            else:
                overlimit = any('transaction limit' in msg.lower() for msg in errors.values())
                if overlimit:
                    raise APILimitExceeded("This API key has used up its daily quota of calls.")
                else:    
                    messages = " ".join(["{}: {}".format(k,v) for k, v in errors.items()])    
        elif self.format == 'xml':
            import xml.etree.ElementTree as ET
            errors = ET.fromstring(resp).findall(self.ERROR_TOKEN)
            messages = ", ".join(err.find('msg').text for err in errors)
        else:
            raise ValueError("Invalid API response format specified: {}." % self.format)        
        
        raise BustimeError("API returned: {}".format(messages))
720443
public static function sendErrorsToAdmin() {
		// determine if we need to send anything
		$found = false;
		foreach (\Object\Error\Base::$errors as $k => $v) {
			if ($v['errno'] != -1) {
				$found = true;
				break;
			}
		}
		// we do not send suppresed errors to admin for now. !empty(self::$data['suppressed'])
		if ($found || !empty(self::$data['js'])) {
			$message = '<hr/>';
			$message.= '<br/>IP: ' . \Request::ip();
			$message.= '<br/>Host: ' . \Request::host();
			$message.= '<br/>Script folder: ' . getcwd();
			$message.= '<hr/>';
			$message.= str_replace('display: none;', '', self::render());
			return \Mail::send([
				'to' => self::$email,
				'subject' => 'application error',
				'message' => $message
			]);
		}
	}
525545
def handle_error(
        self, error, req, schema, error_status_code=None, error_headers=None
    ):
        
        logger.error(error)
        raise error
918993
def handle_error(self, message: str, e: mastodon.MastodonError) -> OutputRecord:
        """"""
        self.lerror(f"Got an error! {e}")

        # Handle errors if we know how.
        try:
            code = e[0]["code"]
            if code in self.handled_errors:
                self.handled_errors[code]
            else:
                pass

        except Exception:
            pass

        return TootRecord(error=e)
191188
def handle_error(self, request, client_address):
    """"""
    del request  # unused
    # Kludge to override a SocketServer.py method so we can get rid of noisy
    # EPIPE errors. They're kind of a red herring as far as errors go. For
    # example, `curl -N http://localhost:6006/ | head` will cause an EPIPE.
    exc_info = sys.exc_info()
    e = exc_info[1]
    if isinstance(e, IOError) and e.errno == errno.EPIPE:
      logger.warn('EPIPE caused by %s in HTTP serving' % str(client_address))
    else:
      logger.error('HTTP serving error', exc_info=exc_info)
710093
function handleError(type, filepath, opts, cb) {
  return function(err) {
    switch (type) {
      case 'read':
        if (err.code === 'ENOENT') {
          err.message = formatError('file does not exist', filepath, err);
        } else {
          err.message = formatError('cannot read file', filepath, err);
        }
        break;
      case 'write':
        if (!opts.overwrite && err.code === 'EEXIST') {
          return cb();
        }
        err.message = formatError('cannot write to', filepath, err);
        break;
    }
    cb(err);
  };
}
1367604
public function errorHandler(int $error_number, string $error_message) {
    switch ($error_number) {
      case E_RECOVERABLE_ERROR:
        throw new Exception($error_message, $error_number);
    }
  }
744402
def handle_error(self, error, req, schema, error_status_code, error_headers):
        
        status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS
        abort(
            status_code,
            exc=error,
            messages=error.messages,
            schema=schema,
            headers=error_headers,
        )
989912
def error_handler(f):
    """"""
    @wraps(f)
    def inner(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except NoResultFound:
            abort(404)
        except IntegrityError:
            abort(500)
    return inner
1254571
def handleError(self, error_code, message):
        ''''''
        self._fail = True
        self.reason = error_code
        self._error = message