Package org.jruby

Examples of org.jruby.RubyException


        public IRubyObject weakref_alive_p() {
            return ref.get() != null ? getRuntime().getTrue() : getRuntime().getFalse();
        }

        private RaiseException newRefError(String message) {
            RubyException exception =
                    (RubyException)getRuntime().getClass("RefError").newInstance(getRuntime().getCurrentContext(),
                    new IRubyObject[] {getRuntime().newString(message)}, Block.NULL_BLOCK);

            return new RaiseException(exception);
        }
View Full Code Here


            if (filename == null) {
                filename = "<unknown>";
            }           
            return runtime.parseEval(script, filename, null, 0);
        } catch (RaiseException e) {
            RubyException re =  e.getException();
            runtime.printError(re);
            throw new ScriptException(e);
        } catch (Exception e) {
            throw new ScriptException(e);
        } finally {
View Full Code Here

                return runtime.parseEval(script, filename, null, 0);
            }
            InputStream inputStream = getRubyReader(filename);
            return runtime.parseFile(inputStream, filename, null);
        } catch (RaiseException e) {
            RubyException re =  e.getException();
            runtime.printError(re);
            throw new ScriptException(e);
        } catch (Exception exp) {
            throw new ScriptException(exp);
        } finally {
View Full Code Here

            throw new ScriptException(exp);
        } finally {
            try {
                JavaEmbedUtils.terminate(runtime);
            } catch (RaiseException e) {
                RubyException re =  e.getException();
                runtime.printError(re);
                if (!runtime.fastGetClass("SystemExit").isInstance(re)) {
                    throw new ScriptException(e);
                }
            } finally {
View Full Code Here

            throw new ScriptException(exp);
        } finally {
            try {
                JavaEmbedUtils.terminate(runtime);
            } catch (RaiseException e) {
                RubyException re =  e.getException();
                runtime.printError(re);
                if (!runtime.fastGetClass("SystemExit").isInstance(re)) {
                    throw new ScriptException(e);
                }
            } finally {
View Full Code Here

        GlobalVariables oldGlobals = runtime.getGlobalVariables();
        try {
            setGlobalVariables(ctx);
            return rubyToJava(runtime.eval(node));
        } catch (RaiseException exp) {
            RubyException rexp = exp.getException();
            throw new ScriptException(rexp.toString());
        } catch (Exception exp) {
            throw new ScriptException(exp);
        } finally {
            if (oldGlobals != null) {
                //setGlobalVariables(oldGlobals);
View Full Code Here

            return new DebugHandlingNode(node);
        return null;
    }

    private ScriptException parseRubyParseException(ParseFailedException e) {
        RubyException re = ((RaiseException) e.getCause()).getException();
        String msg = re.message.asJavaString();
        msg = msg.substring(getName().length() + 1);
        int lidx = msg.indexOf(':');
        int line = Integer.parseInt(msg.substring(0, lidx));
        msg = msg.substring(lidx + 2);
View Full Code Here

        }
        return result;
    }

    private IRubyObject handleException(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock, RaiseException raiseJump) {
        RubyException raisedException = raiseJump.getException();
        RescueBodyNode cRescueNode = rescueNode;

        while (cRescueNode != null) {
            IRubyObject[] exceptions = getExceptions(cRescueNode, runtime, context, self, aBlock);
View Full Code Here

    private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) {
        pw.println("Thread: " + th.getNativeThread().getName());
        pw.println("Stack:");
        ThreadContext tc = th.getContext();
        if (tc != null) {
            RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump");
            exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace(), true));
            pw.println(Format.MRI.printBacktrace(exc, false));
        } else {
            pw.println("    [no longer alive]");
        }
        pw.println();
View Full Code Here

    public static RaiseException newSqlError(Ruby runtime,
            DriverDefinition driver,
            String message) {
        RubyModule doModule = runtime.getModule(DATA_OBJECTS_MODULE_NAME);
        RubyClass driverError = doModule.getClass(Type.SQL_ERROR.getRubyName());
        RubyException doSqlError = (RubyException) driverError.newInstance(
                runtime.getCurrentContext(),
                new IRubyObject[]{
                    runtime.newString(message)
                },
                Block.NULL_BLOCK);
View Full Code Here

TOP

Related Classes of org.jruby.RubyException

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.