Package net.ex337.scriptus.exceptions

Examples of net.ex337.scriptus.exceptions.ScriptusRuntimeException


       
        Properties r;
        try {
            r = getProperties();
        } catch (IOException e) {
            throw new ScriptusRuntimeException(e);
        }
       
        if(r != null){
            load(r);
        }
View Full Code Here


    String source;
    try {
      source = IOUtils.toString(globalScope.getClass().getClassLoader().getResourceAsStream("wait.js"));
    } catch (IOException e) {
      throw new ScriptusRuntimeException(e);
    }

    Function getLastPid = new FunctionObject("_intern_getLastPid", this.getClass().getMethod("_intern_getLastPid"),
        globalScope);
    Function wait_intern = new FunctionObject("_intern_wait", this.getClass().getMethod("_intern_wait", String.class), globalScope);
View Full Code Here

            case 'M':  calUnit = Calendar.MONTH;        break;
            case 'q':  calUnit = Calendar.MONTH; dur *= 3;    break;
            case 'y':  calUnit = Calendar.YEAR;          break;
            case 'D':  calUnit = Calendar.YEAR; dur *= 10;    break; // decade
            case 'C':  calUnit = Calendar.YEAR;  dur *= 100;    break; // century :-D go long!
            default : throw new WrappedException(new ScriptusRuntimeException("unrecognised unit: "+unit));
          }
         
          until.add(calUnit, dur);
        }
      }
    }
   
    if( ! foundDate) {
      throw new WrappedException(new ScriptusRuntimeException("Could not recognise duration argument: "+o+" must either be integer >1, or match date format "+ScriptusConfig.DATE_FORMAT+" or duration format regexp "+ScriptusConfig.DURATION_FORMAT));
    }

    return until;
   
  }
View Full Code Here

  }

  public Object sleep(Object untilArg) {
   
    if(untilArg == null) {
      throw new ScriptusRuntimeException("no arg presented for sleep");
    }
   
    Calendar until = getDuration(untilArg);
   
    ContinuationPending pending = Context.getCurrentContext().captureContinuation();
View Full Code Here

      compiled = cx.compileFunction(globalScope, "function ___scriptus___ () {"+source+"}", sourceName, 0, null);

    } catch (ScriptusRuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new ScriptusRuntimeException(e);
    } finally {
      Context.exit();
    }

  }
View Full Code Here


  public String get(String url) {
   
    if(url == null) {
      throw new ScriptusRuntimeException("no arg presented for sleep");
    }
   
    URL u;
   
    try {
      u = new URL(url);
    } catch (MalformedURLException e) {
      throw new ScriptusRuntimeException(e);
    }
   
    if( ! "http".equals(u.getProtocol())  && ! "https".equals(u.getProtocol())) {
      throw new ScriptusRuntimeException("only http and https supported right now");
    }
   
    ContinuationPending pending = Context.getCurrentContext().captureContinuation();
    pending.setApplicationState(new Get(u));
    throw pending;
View Full Code Here

      }
     
    }
   
    if(msg == null){
      throw new WrappedException(new ScriptusRuntimeException("invalid args to ask function, format: ask(question, [{who:who, timeout:duration}]"));
    }

    ContinuationPending pending = Context.getCurrentContext().captureContinuation();
    pending.setApplicationState(new Ask(msg, who, timeout, rnd.nextLong()));
    throw pending;
View Full Code Here

      LOG.info("script continuation, state obj=" + state.getClass());

      if (state instanceof ScriptAction) {
        return (ScriptAction) state;
      } else {
        throw new ScriptusRuntimeException("Continuation state not ScriptAction:" + state);
      }

    }

    state = result;
View Full Code Here

      }
     
    }
   
    if(msg == null){
      throw new WrappedException(new ScriptusRuntimeException("no message argument to say function"));
    }
   
    ContinuationPending pending = Context.getCurrentContext().captureContinuation();
    pending.setApplicationState(new Say(msg, who));
    throw pending;
View Full Code Here

       
        socialAuthConfig = SocialAuthConfig.getDefault();
        try{
            socialAuthConfig.load(socialAuthProps);
        } catch(Exception e)  {
            throw new ScriptusRuntimeException(e);
        }
       

    }
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.exceptions.ScriptusRuntimeException

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.