Attempts to turn a SIGTERM exception into a SystemExit exception.
350385
def _turn_sigterm_into_systemexit(): # pragma: no cover
    
    try:
        import signal
    except ImportError:
        return
    def handle_term(signo, frame):
        raise SystemExit
    signal.signal(signal.SIGTERM, handle_term)
1245974
def send_exception(self):
        """"""
        self.compiler.reset()

        exc = traceback.format_exc()
        self.writer.write(exc.encode('utf8'))

        yield from self.writer.drain()
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
246248
def exception(self, s):
        """"""
        self.error(s)
        type, value, tb = sys.exc_info()
        self.writelines(traceback.format_stack(), 1)
        self.writelines(traceback.format_tb(tb)[1:], 1)
        self.writelines(traceback.format_exception_only(type, value), 1)
490117
def remove_on_exception(dirname, remove=True):
    """"""
    os.makedirs(dirname)
    try:
        yield
    except:
        if remove:
            shutil.rmtree(dirname, ignore_errors=True)
        raise
1080901
def on_panic(etype, value, tb):
    
    _logging.critical(_traceback.format_exception(etype, value, tb))
    _be.propagate_exc(SystemExit, 1)
1270376
public void execute() throws Exception
    {
        try 
        {
			sessionService.beginTransaction();
            log.info("Inserting InitialDatas");
			new InitialDatas(systemInfoDao, systemUnderTestDao, repositoryDao).insert();

            log.info("Inserting DefaultRunners");
			new DefaultRunners(systemUnderTestDao, properties).insert();

            log.info("Upgrading to version {} ", GreenPepperServer.VERSION);
			new ServerUpgrader(sessionService, systemInfoDao).upgradeTo(GreenPepperServer.VERSION);
			
			sessionService.commitTransaction();
		} 
        catch (Exception e) 
        {
        	sessionService.rollbackTransaction();
        	log.error("Bootstrap Failure: ", e);
        	throw new GreenPepperServerException("", "Boostrap Failure", e);
		}
    }
755269
def from_exception(exc, uuid=None):
        
        if not isinstance(exc, Error):
            exc = Error(code=500, message=str(exc))

        return Result(
            uuid=exc.extra.get("uuid", uuid or random_uuid()),
            retcode=exc.code, stderr=exc.message,
            retval=dict(error=ErrorSchema().dump(exc))
        )
637246
def sigterm_handler(signum, stack_frame):
    
    # pylint: disable-msg=W0613
    global _KILLED

    for name, cmd in _COMMANDS.iteritems():
        if cmd.at_stop:
            LOG.info("at_stop: %r", name)
            cmd.at_stop()

    _KILLED = True

    if _HTTP_SERVER:
        _HTTP_SERVER.kill()
        _HTTP_SERVER.server_close()
16663
public static SystemException unwrapSystemException(Throwable throwable) {
        if (throwable == null) {
            return null;
        } else if (throwable instanceof SystemException) {
            return (SystemException) throwable;
        } else if (throwable.getCause() != null) {
            // recursive call to unwrap the cause
            return unwrapSystemException(throwable.getCause());
        } else {
            // didn't find any SystemException in the cause stack
            return null;
        }
    }
915117
def standard_exception_handling
      yield
    rescue SystemExit
      # Exit silently with current status
      raise
    rescue OptionParser::InvalidOption => ex
      $stderr.puts ex.message
      exit(false)
    rescue Exception => ex
      # Exit with error message
      display_error_message(ex)
      exit_because_of_exception(ex)
    end
137155
def system(*args, **kwargs):
    """"""
    kwargs.setdefault('stdout', subprocess.PIPE)
    proc = subprocess.Popen(args, **kwargs)
    out, _ = proc.communicate()
    if proc.returncode:
        raise SystemExit(proc.returncode)
    return out.decode('utf-8')
330940
public void executeAndWait() throws Exception
    {
        Process p = launchProcess();
        checkForErrors(p);

		if (log.isDebugEnabled())
		{
			// GP-551 : Keep trace of outputs
			if (isNotBlank(getOutput()))
			{
				log.debug("System Output during execution : \n" + getOutput());
			}
			
			if (gobbler.hasErrors())
			{
				log.debug("System Error Output during execution : \n" + getError());
			}
		}
    }
60283
public static String convertExceptionToMessage(Throwable ex)
  {
    StringBuilder sb = new StringBuilder();
    if(ex != null)
    {
      sb.append("Exception type: ").append(ex.getClass().getName()).append("\n");
      sb.append("Message: ").append(ex.getLocalizedMessage()).append("\n");
      sb.append("Stacktrace: \n");
      StackTraceElement[] st = ex.getStackTrace();
      for (int i = 0; i < st.length; i++)
      {
        sb.append(st[i].toString());
        sb.append("\n");
      }
    }
    return sb.toString();
  }
352632
public final void mNOT() throws RecognitionException {
        try {
            int _type = NOT;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:112:4: ( ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' ) )
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:112:6: ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' )
            {
            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        	// do for sure before leaving
        }
    }
1186729
private Exception generateException(int rc, String text,
                                        Exception linkedException, boolean throwIt)
                    throws SIResourceException, SIConnectionLostException,
                    SILimitExceededException, SIErrorException, SINotAuthorizedException,
                    SINotPossibleInCurrentConfigurationException,
                    SIIncorrectCallException, SIAuthenticationException {

        Exception theException;

        if (rc == TrmConstantsImpl.RETURN_CODE_SIResourceException) {
            SIResourceException sire = new SIResourceException(text);
            if (null != linkedException) {
                sire.initCause(linkedException);
            }
            if (throwIt) {
                throw sire;
            } else {
                theException = sire;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIConnectionLostException) {
            SIConnectionLostException sicle = new SIConnectionLostException(text);
            if (null != linkedException) {
                sicle.initCause(linkedException);
            }
            if (throwIt) {
                throw sicle;
            } else {
                theException = sicle;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SILimitExceededException) {
            SILimitExceededException silee = new SILimitExceededException(text);
            if (null != linkedException) {

            }
            if (throwIt) {
                throw silee;
            } else {
                theException = silee;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIErrorException) {
            SIErrorException siee = new SIErrorException(text);
            if (null != linkedException) {
                siee.initCause(linkedException);
            }
            if (throwIt) {
                throw siee;
            } else {
                theException = siee;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SINotAuthorizedException) {
            SINotAuthorizedException sinae = new SINotAuthorizedException(text);
            if (null != linkedException) {
                // This is not permitted!

            }
            if (throwIt) {
                throw sinae;
            } else {
                theException = sinae;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SINotPossibleInCurrentConfigurationException) {
            SINotPossibleInCurrentConfigurationException sinpicce = new SINotPossibleInCurrentConfigurationException(
                            text);
            if (null != linkedException) {
                sinpicce.initCause(linkedException);
            }
            if (throwIt) {
                throw sinpicce;
            } else {
                theException = sinpicce;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIIncorrectCallException) {
            SIIncorrectCallException siice = new SIIncorrectCallException(text);
            if (null != linkedException) {
                siice.initCause(linkedException);
            }
            if (throwIt) {
                throw siice;
            } else {
                theException = siice;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIAuthenticationException) {
            SIAuthenticationException siae = new SIAuthenticationException(text);
            if (null != linkedException) {
                // This is not permitted!
            }
            if (throwIt) {
                throw siae;
            } else {
                theException = siae;
            }
        } else {
            SIErrorException siee = new SIErrorException(text);
            if (null != linkedException) {
                siee.initCause(linkedException);
            }
            if (throwIt) {
                throw siee;
            } else {
                theException = siee;
            }
        }

        return theException;
    }
371221
def handling_errors(self, all_errors_exit=False):
        """"""
        try:
            yield
        except SystemExit as err:
            self.exit(err.code)
        except BaseException:
            etype, value, tb = sys.exc_info()
            for _ in range(num_added_tb_layers):
                if tb is None:
                    break
                tb = tb.tb_next
            traceback.print_exception(etype, value, tb)
            if all_errors_exit:
                self.exit(1)