Package cn.bran.japid.exceptions

Examples of cn.bran.japid.exceptions.JapidTemplateException


    if (e instanceof RuntimeException && e.getCause() != null)
      e = e.getCause();

    if (e instanceof JapidCompilationException) {
      JapidCompilationException jce = (JapidCompilationException) e;
      JapidTemplateException te = JapidTemplateException.from(jce);
      RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
      return (rr);
    }

    e.printStackTrace();

    // find the latest japidviews exception or the controller that caused
    // the exception
    StackTraceElement[] stackTrace = e.getStackTrace();
    for (StackTraceElement ele : stackTrace) {
      String className = ele.getClassName();
      if (className.startsWith("japidviews")) {
        int lineNumber = ele.getLineNumber();
        RendererClass applicationClass = japidClasses.get(className);
        if (applicationClass != null) {
          // let's get the line of problem
          int oriLineNumber = applicationClass.mapJavaLineToJapidScriptLine(lineNumber);
          if (oriLineNumber > 0) {
            if (rendererClass != null) {
              String path = applicationClass.getOriSourceCode();
              JapidTemplateException te = new JapidTemplateException("Japid Error", path + "("
                  + oriLineNumber + "): " + e.getClass().getName() + ": " + e.getMessage(),
                  oriLineNumber, path, applicationClass.getOriSourceCode());
              RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
              return (rr);
            }
          }
        }
      } else if (className.startsWith("controllers.")) {
        if (e instanceof RuntimeException)
          throw (RuntimeException) e;
        else
          throw new RuntimeException(e);
      }
    }

    JapidTemplateException te = new JapidTemplateException(e);
    RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
    return rr;
    // if (e instanceof RuntimeException)
    // throw (RuntimeException) e;
    // else
View Full Code Here


    if (e instanceof RuntimeException && e.getCause() != null)
      e = e.getCause();

    if (e instanceof JapidCompilationException) {
      JapidCompilationException jce = (JapidCompilationException) e;
      JapidTemplateException te = JapidTemplateException.from(jce);
      RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
      return (rr);
    }

    e.printStackTrace();

    // find the latest japidviews exception or the controller that caused
    // the exception
    StackTraceElement[] stackTrace = e.getStackTrace();
    for (StackTraceElement ele : stackTrace) {
      String className = ele.getClassName();
      if (className.startsWith("japidviews")) {
        int lineNumber = ele.getLineNumber();
        RendererClass applicationClass = japidClasses.get(className);
        if (applicationClass != null) {
          // let's get the line of problem
          int oriLineNumber = applicationClass.mapJavaLineToJapidScriptLine(lineNumber);
          if (oriLineNumber > 0) {
            if (rendererClass != null) {
              String path = applicationClass.getScriptPath();
              JapidTemplateException te = new JapidTemplateException("Japid Error", path + "("
                  + oriLineNumber + "): " + e.getClass().getName() + ": " + e.getMessage(),
                  oriLineNumber, path, applicationClass.getJapidSourceCode());
              RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
              return (rr);
            }
          }
        }
      } else if (className.startsWith("controllers.")) {
        if (e instanceof RuntimeException)
          throw (RuntimeException) e;
        else
          throw new RuntimeException(e);
      }
    }

    JapidTemplateException te = new JapidTemplateException(e);
    RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
    return rr;
    // if (e instanceof RuntimeException)
    // throw (RuntimeException) e;
    // else
View Full Code Here

          int oriSrcLineNum = DirUtil.mapJavaLineToSrcLine(javaSourceCode, problem.getSourceLineNumber());
          String scriptPath = rc.getScriptPath();
          if (oriSrcLineNum > 0) {
            // has a original script marker
            descr = scriptPath + "(line " + oriSrcLineNum + "): " + message;
            JapidTemplateException te = new JapidTemplateException("Japid Compilation Error", descr,
                oriSrcLineNum, scriptPath, rc.getJapidSourceCode());
            throw te;
          } else {
            JapidTemplateException te = new JapidTemplateException("Japid Compilation Error", descr, line,
                srcFile, javaSourceCode);
            throw te;

          }
        }
View Full Code Here

    if (e instanceof RuntimeException && e.getCause() != null)
      e = e.getCause();

    if (e instanceof JapidCompilationException) {
      JapidCompilationException jce = (JapidCompilationException) e;
      JapidTemplateException te = JapidTemplateException.from(jce);
      RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
      return (rr);
    }

    e.printStackTrace();

    // find the latest japidviews exception or the controller that caused
    // the exception
    StackTraceElement[] stackTrace = e.getStackTrace();
    for (StackTraceElement ele : stackTrace) {
      String className = ele.getClassName();
      if (className.startsWith("japidviews")) {
        int lineNumber = ele.getLineNumber();
        RendererClass applicationClass = japidClasses.get(className);
        if (applicationClass != null) {
          // let's get the line of problem
          int oriLineNumber = applicationClass.mapJavaLineToJapidScriptLine(lineNumber);
          if (oriLineNumber > 0) {
            if (rendererClass != null) {
              String path = applicationClass.getScriptPath();
              JapidTemplateException te = new JapidTemplateException("Japid Error", path + "("
                  + oriLineNumber + "): " + e.getClass().getName() + ": " + e.getMessage(),
                  oriLineNumber, path, applicationClass.getJapidSourceCode());
              RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
              return (rr);
            }
          }
        }
      } else if (className.startsWith("controllers.")) {
        if (e instanceof RuntimeException)
          throw (RuntimeException) e;
        else
          throw new RuntimeException(e);
      }
    }

    JapidTemplateException te = new JapidTemplateException(e);
    RenderResult rr = RenderInvokerUtils.invokeRender(rendererClass, te);
    return rr;
    // if (e instanceof RuntimeException)
    // throw (RuntimeException) e;
    // else
View Full Code Here

TOP

Related Classes of cn.bran.japid.exceptions.JapidTemplateException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.