If "failOnError" is enabled, throws a MojoExecutionException. Otherwise, logs the exception
and resumes execution.

@param msg The exception message.
@param e The original exceptions.
@throws MojoExecutionException Thrown exception.
176749
public void throwMojoException(String msg, Throwable e) throws MojoExecutionException {
        if (failOnError) {
            throw new MojoExecutionException(msg, e);
        } else {
            getLog().error(msg, e);
        }
    }
1272404
private Exception mapEJBException(EJSDeployedSupport s, EJBException e) throws CSIException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "mapEJBException: " + e);
        }

        Exception mappedException = null;
        String message = " ";

        // First map EJBException to a RemoteException.
        RemoteException rex;

        if (e instanceof TransactionRolledbackLocalException)
        {
            rex = new TransactionRolledbackException(message);
        }
        else if (e instanceof AccessLocalException)
        {
            rex = new AccessException(message);
        }
        else if (e instanceof InvalidTransactionLocalException)
        {
            rex = new InvalidTransactionException(message);
        }
        else if (e instanceof NoSuchObjectLocalException)
        {
            rex = new NoSuchObjectException(message);
        }
        else if (e instanceof TransactionRequiredLocalException)
        {
            rex = new TransactionRequiredException(message);
        }
        //        else if (e instanceof InvalidActivityLocalException)
//        {
//            rex = new InvalidActivityException(message);
//        }
//        else if (e instanceof ActivityRequiredLocalException)
//        {
//            rex = new ActivityRequiredException(message);
//        }
//        else if (e instanceof ActivityCompletedLocalException)
//        {
//            rex = new ActivityCompletedException(message);
//        }
        else
        {
            rex = new RemoteException(message);
        }

        // Now set detail in RemoteException.
        rex.detail = s.rootEx;

        // Since this code created the RemoteException being passed
        // to OrbUtilsImpl.mapException method, set the stack trace
        // in it to be the exception stack from the root exception
        // so that any exception chain the ORB returns to the
        // client (e.g. CORBA UnknownException case) does not point
        // to this code as being the root cause of the problem.
        rex.setStackTrace(s.rootEx.getStackTrace()); //180095

        // If the current method request came through the ORB, then the final
        // RemoteException must be mapped to the appropriate CORBA exception.
        // Otherwise, for example for WebService Endpoint methods, the
        // RemoteException does not need to be mapped to anything,
        // WebServices will do that.                                       d228774
        if (s.ivWrapper.ivInterface.ivORB)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "mapEJBException calling OrbUtils.mapException: " + rex);
            }

            // Now have OrbUtils map to a CORBA exception for remote client stub.
            mappedException = getOrbUtils().mapException(rex);
        }
        else
        {
            mappedException = rex;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "mapEJBException returning: " + mappedException);
        }
        return mappedException;
    }
239271
private void handleJobExecutionException(JobExecutionException e, UUID jobId) {
    logger.error("Exception thrown from job " + jobId.toString(), e);
    removeScheduledJob(jobId, false);
  }
361190
protected static void warn(Object mojo, String msg) throws Exception {
        Method method = mojo.getClass().getMethod(GET_LOG_METHOD);
        method.setAccessible(true);
        Object logObject = method.invoke(mojo);
        method = logObject.getClass().getMethod(WARN_METHOD, CharSequence.class);
        method.setAccessible(true);
        method.invoke(logObject, msg);
    }
632449
public static function onFailure(\Exception $e, \Resque_Job $job)
    {
        /** @var JobBase $failedJob */
        $failedJob = $job->getInstance();
        $failedJob->errorLog('Caught exception in '. get_called_class() . ': ' . $e->getMessage());
        $failedJob->getStat()->increment($failedJob->getStatFailureIncrementKey());
        throw $e;
    }
1323803
public static void e(String msg, Element element) {
		messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
	}
79826
public void executeMojo(MojoExecution mojo) throws MojoExecutionException, MojoFailureException {
		try {
			this.buildPluginManager.executeMojo(this.session, mojo);
		} catch (PluginConfigurationException
				| PluginManagerException e) {
			throw new MojoFailureException(e.getLocalizedMessage(), e);
		}
	}
1253450
public synchronized void execute() throws MojoExecutionException, MojoFailureException {
        try {
            doExecute();
        }
        catch (Exception e) {
            //
            // NOTE: Wrap to avoid truncating the stacktrace
            //

            if (e instanceof MojoExecutionException) {
                throw new MojoExecutionException(e.getMessage(), e);
            }
            else if (e instanceof MojoFailureException) {
                MojoFailureException x = new MojoFailureException(e.getMessage());
                x.initCause(e);
                throw x;
            }
            else {
                throw new MojoExecutionException(e.getMessage(), e);
            }
        }
    }
138203
@Override
    public void execute() throws MojoExecutionException {
        try {
            // Work around for Application Insights Java SDK:
            // Sometimes, NoClassDefFoundError will be thrown even after Maven build is completed successfully.
            // An issue has been filed at https://github.com/Microsoft/ApplicationInsights-Java/issues/416
            // Before this issue is fixed, set default uncaught exception handler for all threads as work around.
            Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler());

            final Properties prop = new Properties();
            if (isFirstRun(prop)) {
                infoWithMultipleLines(PRIVACY_STATEMENT);
                updateConfigurationFile(prop);
            }

            if (isSkipMojo()) {
                info("Skip execution.");
                trackMojoSkip();
            } else {
                trackMojoStart();

                doExecute();

                trackMojoSuccess();
            }
        } catch (Exception e) {
            handleException(e);
        } finally {
            // When maven goal executes too quick, The HTTPClient of AI SDK may not fully initialized and will step
            // into endless loop when close, we need to call it in main thread.
            // Refer here for detail codes: https://github.com/Microsoft/ApplicationInsights-Java/blob/master/core/src
            // /main/java/com/microsoft/applicationinsights/internal/channel/common/ApacheSender43.java#L103
            try {
                // Sleep to wait ai sdk flush telemetries
                Thread.sleep(2 * 1000);
            } catch (InterruptedException e) {
                // swallow this exception
            }
            ApacheSenderFactory.INSTANCE.create().close();
        }
    }
546526
public void execute() throws MojoExecutionException, MojoFailureException {
		try {
			createBundles();
		} catch (Exception ex) {
			Logger logger = Logger.getLogger(JawrMojo.class.getName());
			if(ex instanceof ServletException){
				logger.log(Level.SEVERE, null, ((ServletException)ex).getRootCause());
			}else{
				logger.log(Level.SEVERE, null, ex);
			}
			throw new MojoFailureException("JAWR Maven plugin failed: " + ex.getLocalizedMessage());
		}
	}
295907
private static void throwRuntimeException(String msg, InvocationTargetException e) {
    Throwable cause = e.getCause();
    if (cause != null) {
      throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
    } else {
      throw new RuntimeException(msg + ": " + e.getMessage(), e);
    }
  }
1095516
private void checkFail(String errorMsg) throws IOException {
    if (fsNamesys.failOnTxIdMismatch()) {
      FSEditLog.LOG.error(errorMsg);
      throw new IOException(errorMsg);
    }
    MetaRecoveryContext.editLogLoaderPrompt(errorMsg);
  }
9264
private static void log(FacesContext context, String msg, Exception e)
    {
        context.getExternalContext().log(msg, e);
    }
1214655
protected void onException(SQLListenerContextImpl context, Exception e) {
        context.setException(e);
        listeners.exception(context);
    }
25642
public static void log( String context , JMSException e , Log log )
	{
		StringBuilder message = new StringBuilder();
		if (context != null)
		{
			message.append("[");
			message.append(context);
			message.append("] ");
		} 
		if (e.getErrorCode() != null)
		{
			message.append("error={");
			message.append(e.getErrorCode());
			message.append("} ");
		}
		message.append(e.getMessage());
		log.error(message.toString());
		if (e.getLinkedException() != null)
			log.error("Linked exception was :",e.getLinkedException());
	}
627967
public void e(final String msg) {
        logMgr.log(tag, LogLevelConst.ERROR, msg, null);
    }
70803
public static void execute(Object mojo) throws Exception {
        // Note that the object can be an instance of
        // AbstractSurefireMojo.
        if (!(isSurefirePlugin(mojo) || isFailsafePlugin(mojo))) {
            return;
        }
        // Check if the same object is already invoked.  This may
        // happen (in the future) if execute method is in both
        // AbstractSurefire and SurefirePlugin classes.
        if (isAlreadyInvoked(mojo)) {
            return;
        }

        // Check if surefire version is supported.
        checkSurefireVersion(mojo);
        // Check surefire configuration.
        checkSurefireConfiguration(mojo);

        try {
            // Update argLine.
            updateArgLine(mojo);
            // Update excludes.
            updateExcludes(mojo);
            // Update parallel.
            updateParallel(mojo);
        } catch (Exception ex) {
            // This exception should not happen in theory.
            throwMojoExecutionException(mojo, "Unsupported surefire version", ex);
        }
    }