Provides the default exception handling for the given block.
322423
def nimbus_exception_handling
      begin
        yield
      rescue SystemExit => ex
        raise
      rescue Nimbus::Error => ex
        display_error_message(ex)
        Nimbus.stop
      rescue Exception => ex
        display_error_message(ex)
        Nimbus.stop
      end
    end
238418
def exception_handler(self, callback):
        
        path = '.'.join([callback.__module__, callback.__name__])
        self._exception_handlers.append(path)
        return callback
78759
private void handleException(final Throwable e)
    {
        if ( errorListeners.size() == 0 )
        {
            LOG.error("", e);
        }
        else
        {
            errorListeners.forEach(new Function<UnhandledErrorListener, Void>()
            {
                @Override
                public Void apply(UnhandledErrorListener listener)
                {
                    try
                    {
                        listener.unhandledError("", e);
                    }
                    catch ( Exception e )
                    {
                        ThreadUtils.checkInterrupted(e);
                        LOG.error("Exception handling exception", e);
                    }
                    return null;
                }
            });
        }
    }
208181
def handle_error(self, e):
        
        got_request_exception.send(current_app._get_current_object(), exception=e)

        if not isinstance(e, HTTPException) and current_app.propagate_exceptions:
            exc_type, exc_value, tb = sys.exc_info()
            if exc_value is e:
                raise
            else:
                raise e

        headers = Headers()
        if isinstance(e, HTTPException):
            code = e.code
            default_data = {
                'message': getattr(e, 'description', http_status_message(code))
            }
            headers = e.get_response().headers
        else:
            code = 500
            default_data = {
                'message': http_status_message(code),
            }

        # Werkzeug exceptions generate a content-length header which is added
        # to the response in addition to the actual content-length header
        # https://github.com/flask-restful/flask-restful/issues/534
        remove_headers = ('Content-Length',)

        for header in remove_headers:
            headers.pop(header, None)

        data = getattr(e, 'data', default_data)

        if code and code >= 500:
            exc_info = sys.exc_info()
            if exc_info[1] is None:
                exc_info = None
            current_app.log_exception(exc_info)

        error_cls_name = type(e).__name__
        if error_cls_name in self.errors:
            custom_data = self.errors.get(error_cls_name, {})
            code = custom_data.get('status', 500)
            data.update(custom_data)

        if code == 406 and self.default_mediatype is None:
            # if we are handling NotAcceptable (406), make sure that
            # make_response uses a representation we support as the
            # default mediatype (so that make_response doesn't throw
            # another NotAcceptable error).
            supported_mediatypes = list(self.representations.keys())
            fallback_mediatype = supported_mediatypes[0] if supported_mediatypes else "text/plain"
            resp = self.make_response(
                data,
                code,
                headers,
                fallback_mediatype = fallback_mediatype
            )
        else:
            resp = self.make_response(data, code, headers)

        if code == 401:
            resp = self.unauthorized(resp)
        return resp
468569
@ConditionBlock
  public void evaluate(Runnable block) {
    try {
      block.run();
    } catch (Throwable t) {
      exceptions.add(t);
      wakeUp();
    }
    latch.countDown();
  }
1305570
def _exception_default_handler(self, e):
        
        if isinstance(e, HTTPError):
            if e.log_message:
                format = "%d %s: " + e.log_message
                args = [e.status_code, self._request_summary()] + list(e.args)
                app_log.warning(format, *args)
            if e.status_code not in httplib.responses:
                app_log.error("Bad HTTP status code: %d", e.status_code)
                self.send_error(500, exc_info=sys.exc_info())
            else:
                self.send_error(e.status_code, exc_info=sys.exc_info())
        else:
            app_log.error("Uncaught exception %s\n%r", self._request_summary(),
                          self.request, exc_info=True)
            self.send_error(500, exc_info=sys.exc_info())
696983
protected function initExceptionHandler()
    {
        if (!isset($this->chainedExceptionHandler)) {
            $this->chainedExceptionHandler = $this->setExceptionHandler([$this, 'handleException']) ?: false;
        }
    }
521575
def on_trap(object_id, &block)
      raise ArgumentError, "a block must be provided" unless block
      @lock.synchronize { @oid_handler[ObjectId.new(object_id)] = block }
    end
339174
public static void setDefaultInterpretErrorHandler (@Nonnull final ICSSInterpretErrorHandler aDefaultErrorHandler)
  {
    ValueEnforcer.notNull (aDefaultErrorHandler, "DefaultErrorHandler");

    s_aRWLock.writeLocked ( () -> s_aDefaultInterpretErrorHandler = aDefaultErrorHandler);
  }
1140215
private static <E extends RuntimeException> E handleException(E ex) {
        if (JodaTime.hasExpectedBehavior())
            return ex;
        throw new IllegalStateException("Joda-time 2.2 or later version is required, but found version: " + JodaTime.getVersion(), ex);
    }
1237897
def standard_exception_handling
      begin
        yield
      rescue SystemExit => ex
        # Exit silently with current status
        raise
      rescue OptionParser::InvalidOption => ex
        # Exit silently
        exit(false)
      rescue Exception => ex
        # Exit with error message
        $stderr.puts "#{name} aborted!"
        $stderr.puts ex.message
        if options.trace
          $stderr.puts ex.backtrace.join("\n")
        else
          $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
          $stderr.puts "(See full trace by running task with --trace)"
        end
        exit(false)
      end
    end
1193749
public void writeBlock(byte[] block) throws IOException {

        if (block.length != 512) {
            throw new IllegalArgumentException(
                RB.singleton.getString(RB.BAD_BLOCK_WRITE_LEN, block.length));
        }

        write(block, block.length);
    }
210202
private CatchStatement createCatchBlockForOuterNewTryCatchStatement(String primaryExcName) {
        // { ... }
        BlockStatement blockStatement = new BlockStatement();
        String tExcName = this.genTExcName();

        // #primaryExc = #t;
        ExpressionStatement primaryExcAssignStatement =
                new ExpressionStatement(
                        new BinaryExpression(
                                new VariableExpression(primaryExcName),
                                newSymbol(Types.ASSIGN, -1, -1),
                                new VariableExpression(tExcName)));
        astBuilder.appendStatementsToBlockStatement(blockStatement, primaryExcAssignStatement);

        // throw #t;
        ThrowStatement throwTExcStatement = new ThrowStatement(new VariableExpression(tExcName));
        astBuilder.appendStatementsToBlockStatement(blockStatement, throwTExcStatement);

        // Throwable #t
        Parameter tExcParameter = new Parameter(ClassHelper.make(Throwable.class), tExcName);

        return new CatchStatement(tExcParameter, blockStatement);
    }
171177
private void defineUncaughtExceptionHandler() {
        MethodInfo mi = mClassFile.addMethod
            (Modifiers.PRIVATE.toStatic(true), UNCAUGHT_METHOD_NAME, null,
             new TypeDesc[] {TypeDesc.forClass(Throwable.class)});
        CodeBuilder b = new CodeBuilder(mi);

        // Thread t = Thread.currentThread();
        // t.getUncaughtExceptionHandler().uncaughtException(t, e);
        TypeDesc threadType = TypeDesc.forClass(Thread.class);
        b.invokeStatic(Thread.class.getName(), "currentThread", threadType, null);
        LocalVariable threadVar = b.createLocalVariable(null, threadType);
        b.storeLocal(threadVar);
        b.loadLocal(threadVar);
        TypeDesc handlerType = TypeDesc.forClass(Thread.UncaughtExceptionHandler.class);
        b.invokeVirtual(threadType, "getUncaughtExceptionHandler", handlerType, null);
        b.loadLocal(threadVar);
        b.loadLocal(b.getParameter(0));
        b.invokeInterface(handlerType, "uncaughtException", null,
                          new TypeDesc[] {threadType, TypeDesc.forClass(Throwable.class)});
        b.returnVoid();
    }
199441
public <E extends Exception>
            RestHandlerExceptionResolverBuilder addHandler(AbstractRestExceptionHandler<E, ?> exceptionHandler) {

        return addHandler(exceptionHandler.getExceptionClass(), exceptionHandler);
    }
155625
def default_action_block
      proc do
        begin
          record = if resource.singular
                    parent_model = resource.parent.model.find(parent_resource_id)
                    parent_model.send resource.name
                  else
                    record = model.find(params[:id])
                  end

          record.update(instance_eval(&@strong_params))
          body record.reload
        rescue ActionController::ParameterMissing => error
          body error.message
          status :bad_request
        end
      end
    end
832473
public final void defaultValue() throws RecognitionException {
		int defaultValue_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 79) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:677:6: ( 'default' elementValue )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:677:8: 'default' elementValue
			{
			match(input,74,FOLLOW_74_in_defaultValue2721); if (state.failed) return;
			pushFollow(FOLLOW_elementValue_in_defaultValue2723);
			elementValue();
			state._fsp--;
			if (state.failed) return;
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 79, defaultValue_StartIndex); }

		}
	}