Package erjang

Examples of erjang.ErlangError


          }
        } catch (ErlangException e) {
          throw e;
        } catch (IllegalArgumentException e) {
          e.printStackTrace();
          throw new ErlangError(e);
        } catch (IllegalAccessException e) {
          e.printStackTrace();
          throw new ErlangError(e);
        } catch (InvocationTargetException e) {
          e.printStackTrace();
          throw new ErlangError(e);
        }
      } else {       
        // for debug output
        List<EObject> aa = new ArrayList<EObject>();
        for (int i = 0; i < vals.length; i++) {
View Full Code Here


      Field f = c.getField(mem_am.getName());

      if (java.lang.reflect.Modifier.isStatic(f.getModifiers())) {
        return JavaObject.box(self, f.get(null));
      } else {
        throw new ErlangError(EString.fromString("not a static field"),
            clzz, member);
      }

    } catch (Exception e) {
      throw new ErlangError(EString.fromString(e.getMessage()), clzz,
          member);
    }
  }
View Full Code Here

       * catch (InvocationTargetException e) { // TODO Auto-generated
       * catch block e.printStackTrace();
       */

    } catch (Exception e) {
      throw new ErlangError(EString.fromString(e.getMessage()), obj,
          member, typez, argz);
    } finally {

    }

View Full Code Here

                    new EFunHandler() {
                        @Override
                        public EObject invoke(EProc proc, EObject[] args)
                                throws Pausable {
                            if (proc != owner)
                                throw new ErlangError(ERT.am_badfun, args);

                            r.run();
                            return ERT.am_ok;
                        }
                    }, getClass().getClassLoader());

    }

    /*
     * a java.util.Map can be used as a function with 1 argument to get a
     * value
     */
    if ((nargs == 1) && (real_object instanceof java.util.Map<?, ?>)) {
      final java.util.Map<?, ?> r = (java.util.Map<?, ?>) real_object;
      return EFunCG.get_fun_with_handler("java.util.Map", "get", 0,
        new EFunHandler() {
          @Override
          public EObject invoke(EProc self, EObject[] args)
              throws Pausable {
            if (self != owner)
              throw new ErlangError(ERT.am_badfun, args);

            Object key = JavaObject.unbox(self, Object.class, args[0]);
            if (r.containsKey(key)) {
              return new ETuple2(args[0], JavaObject.box(self, r
                  .get(key)));
View Full Code Here

    new EFunHandler() {
      @Override
      public EObject invoke(EProc proc, EObject[] args) throws Pausable {

        if (real_object == null) {
          throw new ErlangError(am_null_pointer_exception);
        }

        Method[] methods = real_object.getClass().getMethods();

        return choose_and_invoke_method(proc, real_object, f, args,
View Full Code Here

        result = m.invoke(target, a);
      } catch (IllegalArgumentException e) {
        throw ERT.badarg(args);
      } catch (IllegalAccessException e) {
        throw new ErlangError(am_badaccess, args);
      } catch (InvocationTargetException e) {
        Throwable te = e.getTargetException();
        if (te instanceof ErlangException) {
          throw (ErlangException) te;
        } else {
          ETuple reason = ETuple.make(EAtom.intern(te.getClass()
              .getName()), EString.fromString(te.getMessage()));
          throw new ErlangError(reason, args);
        }
      }

      if (m.getReturnType() == Void.TYPE) {
        return ERT.am_ok;
      }

      return JavaObject.box(self, result);
    }

    throw new ErlangError(am_badfun, args);
  }
View Full Code Here

      } catch (InstantiationException e) {
        throw ERT.badarg(args);
      } catch (IllegalArgumentException e) {
        throw ERT.badarg(args);
      } catch (IllegalAccessException e) {
        throw new ErlangError(am_badaccess, args);
      } catch (InvocationTargetException e) {
        Throwable te = e.getTargetException();
        if (te instanceof ErlangException) {
          throw (ErlangException) te;
        } else {
          ETuple reason = ETuple.make(EAtom.intern(te.getClass()
              .getName()), EString.fromString(te.getMessage()));
          throw new ErlangError(reason, args);
        }
      }

      return JavaObject.box(self, result);
    }

    throw new ErlangError(am_badfun, args);
  }
View Full Code Here

    }

    EObject net_kernel = ERT.whereis(am_net_kernel);   
    EInternalPID nk = net_kernel.testInternalPID();
    if (nk == null) {
      throw new ErlangError(EAtom.intern("no_net_kernel"));
    }
   
    nk.set_dist_entry(this_dist_entry);
    // nk.add_flag( F_DISTRIBUTION );
   
View Full Code Here

    this.heirPID = heir_pid;
    this.heirData = heir_data;
    try {
      this.mapRef = new AtomicReference<IPersistentMap<EObject,Object>>(map);
    } catch (Exception e) {
      throw new ErlangError(am_stm);
    }
    empty = map;
    owner.add_exit_hook(this);
  }
View Full Code Here

    } catch (ErlangError e) {
      throw e;
    } catch (Exception e) {
      e.printStackTrace();
      // STM Failure
      throw new ErlangError(am_stm);
    }
  }
View Full Code Here

TOP

Related Classes of erjang.ErlangError

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.