Package org.jruby.exceptions

Examples of org.jruby.exceptions.RaiseException


    }

    private synchronized IRubyObject pop(ThreadContext context, boolean should_block) {
        checkShutdown(context);
        if (!should_block && entries.size() == 0) {
            throw new RaiseException(context.runtime, context.runtime.getThreadError(), "queue empty", false);
        }
        numWaiting++;
        try {
            while (java_length() == 0) {
                try {
View Full Code Here


    Store getStore() {
        return store;
    }

    private void raise(String msg) {
        throw new RaiseException(getRuntime(),cStoreError, msg, true);
    }
View Full Code Here

            throw runtime.newArgumentError("can't resolve socket address of wrong type");
        }
    }

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

        }
    }

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

        }
        setMemoryIO(Factory.getInstance().allocateDirectMemory(context.runtime,
                size > 0 ? (int) size : 1, align, clear));
        if (getMemoryIO() == null) {
            Ruby runtime = context.runtime;
            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 MemoryPointer newInstance(Ruby runtime, IRubyObject klass, 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", count, typeSize), true);
        }

        return new MemoryPointer(runtime, klass, io, total, typeSize);
    }
View Full Code Here

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

        return newZlibError(runtime, "DataError", message);
    }

    static RaiseException newZlibError(Ruby runtime, String klass, String message) {
        RubyClass errorClass = runtime.getModule("Zlib").getClass(klass);
        return new RaiseException(RubyException.newException(runtime, errorClass, message), true);
    }
View Full Code Here

        RubyException excn = RubyException.newException(runtime, errorClass, message);
        if (runtime.is1_9()) {
            // TODO: not yet supported. rewrite GzipReader/Writer with Inflate/Deflate?
            excn.setInstanceVariable("@input", runtime.getNil());
        }
        return new RaiseException(excn, true);
    }
View Full Code Here

    public static RubyClass getClassFromPath(Ruby rt, String path) {
        return (RubyClass) rt.getClassFromPath(path);
    }
   
    public static RaiseException newError(Ruby rt, String path, String message) {
        return new RaiseException(rt, getClassFromPath(rt, path), message, true);
    }
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.