Package org.jruby.exceptions

Examples of org.jruby.exceptions.RaiseException


     * @param message
     * @return
     */
    private RaiseException newErrnoException(RubyClass exceptionClass, String message) {
        if (RubyInstanceConfig.ERRNO_BACKTRACE) {
            return new RaiseException(this, exceptionClass, message, true);
        } else {
            return new RaiseException(this, exceptionClass, ERRNO_BACKTRACE_MESSAGE, RubyArray.newEmptyArray(this), true);
        }
    }
View Full Code Here


        return new THROW_EXCEPTION_Instr(getArg().cloneForInlining(ii));
    }

    @Override
    public Label interpret(InterpreterContext interp, IRubyObject self) {
        throw new RaiseException((RubyException) getArg().retrieve(interp));
    }
View Full Code Here

        check();
        Ruby runtime = getRuntime();

        if (!isMatched()) {
            RubyClass errorClass = runtime.fastGetClass("StringScanner").fastGetClass("Error");
            throw new RaiseException(RubyException.newException(
                    runtime, errorClass, "unscan failed: previous match had failed"));
        }
        pos = lastPos;
        clearMatched();
        return this;
View Full Code Here

    public RubyIPSocket(Ruby runtime, RubyClass type) {
        super(runtime, type);
    }
   
    protected static RuntimeException sockerr(Ruby runtime, String msg) {
        return new RaiseException(runtime, runtime.fastGetClass("SocketError"), msg, true);
    }
View Full Code Here

        return this;
    }

    private static RuntimeException sockerr(Ruby runtime, String msg) {
        return new RaiseException(runtime, runtime.fastGetClass("SocketError"), msg, true);
    }
View Full Code Here

        }
        setMemoryIO(Factory.getInstance().allocateDirectMemory(context.getRuntime(),
                size > 0 ? (int) size : 1, align, clear));
        if (getMemoryIO() == null) {
            Ruby runtime = context.getRuntime();
            throw new RaiseException(runtime, runtime.getNoMemoryError(),
                    String.format("Failed to allocate %d objects of %d bytes", typeSize, count), true);
        }
       
        if (block.isGiven()) {
            try {
View Full Code Here

    static final MemoryPointer allocate(Ruby runtime, int typeSize, int count, boolean clear) {
        final int total = typeSize * count;
        AllocatedDirectMemoryIO io = Factory.getInstance().allocateDirectMemory(runtime, total > 0 ? total : 1, clear);
        if (io == null) {
            throw new RaiseException(runtime, runtime.getNoMemoryError(),
                    String.format("Failed to allocate %d objects of %d bytes", typeSize, count), true);
        }

        return new MemoryPointer(runtime, runtime.fastGetModule("FFI").fastGetClass("MemoryPointer"), io, total, typeSize);
    }
View Full Code Here

    private IRubyObject prepareRaiseException(Ruby runtime, IRubyObject[] args, Block block) {
        if(args.length == 0) {
            IRubyObject lastException = errorInfo;
            if(lastException.isNil()) {
                return new RaiseException(runtime, runtime.getRuntimeError(), "", false).getException();
            }
            return lastException;
        }

        IRubyObject exception;
View Full Code Here

            Errno errno = Errno.valueOf(runtime.getPosix().errno());
            String name = errno.name();
            String msg  = errno.toString();
            RubyClass errnoClass = runtime.getErrno().fastGetClass(name);
            if (errnoClass != null) {
                throw new RaiseException(runtime, errnoClass, msg, true);
            }
        }
    }
View Full Code Here

        ThreadContext context = runtime.getCurrentContext();
        RubyException exception =
                (RubyException)runtime.getClass("RefError").newInstance(context,
                new IRubyObject[] {runtime.newString(message)}, Block.NULL_BLOCK);
       
        RaiseException re = new RaiseException(exception);
        return re;
    }
View Full Code Here

TOP

Related Classes of org.jruby.exceptions.RaiseException

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.