Exemple #1
0
  @Override
  public Expr inline(final QueryContext qc, final VarScope scp, final Var var, final Expr ex)
      throws QueryException {

    boolean change = false;
    try {
      final Expr sub = expr.inline(qc, scp, var, ex);
      if (sub != null) {
        if (sub.isValue()) return optPre(sub, qc);
        expr = sub;
        change = true;
      }
    } catch (final QueryException qe) {
      if (!qe.isCatchable()) throw qe;
      for (final Catch c : catches) {
        if (c.matches(qe)) {
          // found a matching clause, inline variable and error message
          final Catch nw = c.inline(qc, scp, var, ex);
          return optPre((nw == null ? c : nw).asExpr(qe, qc, scp), qc);
        }
      }
      throw qe;
    }

    for (final Catch c : catches) change |= c.inline(qc, scp, var, ex) != null;
    return change ? this : null;
  }
Exemple #2
0
 /**
  * Processes the HTTP request. Parses new modules and discards obsolete ones.
  *
  * @param http HTTP context
  * @throws Exception exception
  */
 void process(final HTTPContext http) throws Exception {
   try {
     module.process(http, this);
   } catch (final QueryException ex) {
     if (ex.file() == null) ex.info(function.info);
     throw ex;
   }
 }
Exemple #3
0
 @Override
 public Value value(final QueryContext qc) throws QueryException {
   // don't catch errors from error handlers
   try {
     return qc.value(expr);
   } catch (final QueryException ex) {
     if (!ex.isCatchable()) throw ex;
     for (final Catch c : catches) if (c.matches(ex)) return c.value(qc, ex);
     throw ex;
   }
 }
Exemple #4
0
  @Override
  public Expr compile(final QueryContext qc, final VarScope scp) throws QueryException {
    try {
      super.compile(qc, scp);
      if (expr.isValue()) return optPre(expr, qc);
    } catch (final QueryException ex) {
      if (!ex.isCatchable()) throw ex;
      for (final Catch c : catches) {
        if (c.matches(ex)) {
          // found a matching clause, compile and inline error message
          return optPre(c.compile(qc, scp).asExpr(ex, qc, scp), qc);
        }
      }
      throw ex;
    }

    for (final Catch c : catches) c.compile(qc, scp);
    return optimize(qc, scp);
  }