Displays an optional exception message for incorrect program parametrization.

@param e The exception to display.
@return The return code for the process.
484784
private static int handleParametrizationException(ProgramParametrizationException e) {
		LOG.error("Program has not been parametrized properly.", e);
		System.err.println(e.getMessage());
		return 1;
	}
748276
public static EvernoteException convert(Exception ex) {
		// construct exception message
		final StringBuilder sb = new StringBuilder();
		sb.append(ex.getClass().getName());
		if (ex instanceof EDAMUserException) {
			final EDAMErrorCode errorCode = ((EDAMUserException) ex).getErrorCode();
			if (errorCode == null) {
				sb.append(", ErrorCode [null");
			} else {
				sb.append(", ErrorCode [" + errorCode + "(" + errorCode.getValue() + ")");
			}
			sb.append("], Parameter [");
			sb.append(((EDAMUserException) ex).getParameter());
			sb.append("]");
		} else if (ex instanceof EDAMSystemException) {
			final EDAMErrorCode errorCode = ((EDAMSystemException) ex).getErrorCode();
			if (errorCode == null) {
				sb.append(", ErrorCode [null");
			} else {
				sb.append(", ErrorCode [" + errorCode + "(" + errorCode.getValue() + ")");
			}
			sb.append("], Message [");
			sb.append(((EDAMSystemException) ex).getMessage());
			sb.append("], RateLimitDuration [");
			sb.append(((EDAMSystemException) ex).getRateLimitDuration());
			sb.append("]");
		} else if (ex instanceof EDAMNotFoundException) {
			sb.append(", Identifier [");
			sb.append(((EDAMNotFoundException) ex).getIdentifier());
			sb.append("], Key [");
			sb.append(((EDAMNotFoundException) ex).getKey());
			sb.append("]");
		} else {
			sb.append(", Message [");
			sb.append(ex.getMessage());
			sb.append("]");
		}
		return new EvernoteException(sb.toString(), ex);
	}
840203
public static function exceptionHandler($e)
    {

        $message = 'Code: ' . $e->getCode() . "\n" .
                'Path: ' . \sb\Gateway::$request->path . "\n" .
                'Message: ' . $e->getMessage() . "\n" .
                'Location: ' . $e->getFile() . "\n" .
                'Line: ' . $e->getLine() . "\n";
                if(isset(\sb\Gateway::$request)){
                    $message .= 'Request: '.\sb\Gateway::$request->request."\n";
                    if(isset(\sb\Gateway::$request->method)){
                        $message .= 'Method: '.\sb\Gateway::$request->method."\n";
                    }
                    
                    if(count(\sb\Gateway::$request->get)){
                        $message .= 'Get: '.http_build_query(\sb\Gateway::$request->get) ."\n";
                    }
                }

        if (self::$show_trace) {
            $message .= "Trace: \n\t" . str_replace("\n", "\n\t", \print_r($e->getTrace(), 1));
        }

        if (\method_exists("\App", "exception_handler")) {
            if (\App::exceptionHandler($e, $message) === false) {
                return false;
            }
        }

        if (\ini_get("display_errors") == true) {
            if (\sb\Gateway::$command_line) {
                \file_put_contents('php://stderr', "\n" . $message  . "\n");
            } else {
                echo '<pre style="background-color:red;padding:10px;color:#FFF;">' . $message . '</pre>';
            }
        }

        if (!isset(\App::$logger)) {
            \App::$logger = new \sb\Logger\FileSystem();
        }

        \App::$logger->exceptions($message);

    }
142920
protected ErrorInfo getErrorInfo(IOException e) {
    GoogleJsonError gjre = getDetails(e);
    if (gjre != null) {
      return getErrorInfo(gjre);
    }
    return null;
  }
252065
static public String getStackTrace(Exception e) {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		PrintStream ps = new PrintStream(baos);
		e.printStackTrace(ps);
		ps.flush();
		try {
			return baos.toString("UTF-8");
		} catch (UnsupportedEncodingException ee) {
			return baos.toString();
		}
	}
299821
public static void exception (TraceComponent tc, Exception e) {
    exception(null, tc, (Throwable)e);
  }
501258
@JsonIgnore
    public String getErrorMessage() {
        return (params.length == 0) ? exceptionCode.getMessageTemplate() :
                String.format(exceptionCode.getMessageTemplate(), params);
    }
670143
@CheckForNull
    public static String getWin32ErrorMessage(Throwable e) {
        String msg = e.getMessage();
        if(msg!=null) {
            Matcher m = errorCodeParser.matcher(msg);
            if(m.matches()) {
                try {
                    ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors");
                    return rb.getString("error"+m.group(1));
                } catch (Exception ignored) {
                    // silently recover from resource related failures
                }
            }
        }

        if(e.getCause()!=null)
            return getWin32ErrorMessage(e.getCause());
        return null; // no message
    }
38334
public static String exception2String(Exception e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        return sw.toString().trim();
    }
793566
protected String getErrorMessage(Exception e) {

		String ip;
		try {
			ip = InetAddress.getByName(server.split(":")[0]).getHostAddress();
		}
		catch (UnknownHostException e1) {
			ip = null;
			// throw new RuntimeException(e1.getMessage(), e1);
		}
		String message = "server:" + server + " ip:" + ip + " messsage:" + e.getMessage();
		logger.error(message);
		return message;
	}
25883
protected static StringBuilder handleExceptionStart(Exception e) {
        LOG.warning(ExceptionUtils.getStackTrace(e));
        StringBuilder sb = new StringBuilder();
        if (e.getMessage() != null) {
            sb.append(e.getMessage()).append(". ");
        }
        if (e.getCause() != null && e.getCause().getMessage() != null) {
            sb.append(e.getCause().getMessage()).append(". ");
        }
        return sb;
    }
868738
static void showErrorMessage(Exception e, Component parent) {
    String msg = e.getMessage();
    JOptionPane.showMessageDialog(parent, msg, "Error", JOptionPane.ERROR_MESSAGE);
    e.printStackTrace();
  }
237614
public void actionPerformed(ActionEvent e)
	{
		try
		{
			myFunctor.process();
		}
		catch (Exception _exception)
		{
			_exception.printStackTrace(System.err);
		}
	}
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())
1270141
@Nonnull
    protected Throwable getResponseException(Throwable e) {
        // Unwrap execution exceptions.
        if (ExecutionException.class.isAssignableFrom(e.getClass())) {
            return getResponseException(e.getCause());
        }
        return e;
    }
984336
@SuppressWarnings("rawtypes")
  public Class getException() {
    try {
      return Class.forName(errorParam, true, Thread.currentThread().getContextClassLoader()).newInstance().getClass();
    } catch (Exception e) {
      return null;
    }
  }
1217765
public static String exceptionDescription(String encoded)
   {
      char[] data = encoded.toCharArray();
      StringBuilder sb = new StringBuilder();

      for (int i = 0; i < data.length; i++)
      {
         char c = data[i];
         if (c == '|')
         {
            sb = sb.append('\n');
         }
         else if (c == '/')
         {
            sb = sb.append('\r');
         }
         else if (c == '\\')
         {
            sb = sb.append('\t');
         }
         else if (c == '_')
         {
            sb = sb.append(' ');
         }
         else
         {
            sb = sb.append(c);
         }
      }

      return sb.toString();
   }