Example usage for java.lang Error getLocalizedMessage

List of usage examples for java.lang Error getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Error getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:things.view.rest.ThingRestExceptionHandler.java

@ExceptionHandler(Error.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody/*from w  ww . j av a 2  s.com*/
public ErrorInfo error(final HttpServletRequest req, final Error ex) {

    myLogger.debug("Exception: " + ex.getLocalizedMessage(), ex);

    return new ErrorInfo(req.getRequestURL().toString(), ex);
}

From source file:org.fornax.cartridges.sculptor.framework.richclient.errorhandling.ExceptionAware.java

protected T handleError(Error e) {
    String errorCode = ExceptionUtil.resolveSystemExceptionErrorCode(e);
    String translatedMsg = getMessage(errorCode);
    if (translatedMsg == null) {
        translatedMsg = e.getLocalizedMessage();
    }/*w  w  w  .j  a  v  a2  s  .  c  o  m*/
    String systemExceptionMsg = ExceptionUtil.resolveSystemExceptionMessage(e);

    Status status = new Status(IStatus.ERROR, SculptorFrameworkPlugin.PLUGIN_ID, systemExceptionMsg, e);
    Policy.getLog().log(status);
    Policy.getStatusHandler().show(status, translatedMsg);
    throw e;
}

From source file:org.orbisgis.groovy.GroovyConsolePanel.java

/**
 * Expose the map context in the groovy interpreter
 *
 * @param mc MapContext instance//from ww  w. j a  va 2s .  c om
 */
private void setMapContext(MapContext mc) {
    try {
        if (mc != null) {
            variables.put("mc", mc);
        } else {
            variables.remove("mc");
        }
    } catch (Error ex) {
        LOGGER.error(ex.getLocalizedMessage(), ex);
    }
}

From source file:org.trianacode.taskgraph.tool.FileToolbox.java

/**
 * process a java class file//from ww  w .ja  v a2s  . co  m
 *
 * @param url
 * @return
 * @throws Exception
 */
private List<Tool> processClass(URL url) throws Exception {
    try {
        ClassHierarchy ch = TypesMap.isType(url.toString(), Unit.class.getName());
        log.debug("ToolResolver.add class hierarchy:" + ch);
        if (ch == null) {
            ch = TypesMap.getAnnotated(url.toString());
        }
        log.debug("ToolResolver.add class hierarchy after trying annotations:" + ch + " for url " + url);

        if (ch != null) {
            Tool tool = createTool(ch.getName());
            if (tool != null) {

                return Arrays.asList(tool);
            }
        }
    } catch (Error error) {
        System.out.println(url.toString() + " " + error.getLocalizedMessage());
    }
    return new ArrayList<Tool>();
}