Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -4105,8 +4105,7 @@ public RubyString pack(ThreadContext context, IRubyObject obj) {
try {
packer = context.getRuntime().getTrufflePackBridge().compileFormat(iFmt.toString());
} catch (FormatException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().argumentError(e.getMessage(), this));
throw context.getRuntime().newArgumentError(e.getMessage());
}

// We can race on this, but it doesn't matter as long as something goes in the cache
@@ -4118,23 +4117,18 @@ public RubyString pack(ThreadContext context, IRubyObject obj) {
try {
result = packer.pack(values, realLength);
} catch (TooFewArgumentsException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().argumentError("too few arguments", this));
throw context.getRuntime().newArgumentError("too few arguments");
} catch (NoImplicitConversionException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(e.getObject(), e.getTarget(), this));
throw context.getRuntime().newTypeError("todo");
} catch (OutsideOfStringException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().argumentError("X outside of string", this));
throw context.getRuntime().newArgumentError("X outside of string");
} catch (CantCompressNegativeException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().argumentError("can't compress negative numbers", this));
throw context.getRuntime().newArgumentError("can't compress negative numbers");
} catch (RangeException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().rangeError(e.getMessage(), this));
throw context.getRuntime().newRangeError(e.getMessage());
} catch (CantConvertException e) {
throw new UnsupportedOperationException();
//throw new RaiseException(getContext().getCoreLibrary().typeError(e.getMessage(), this));
throw context.getRuntime().newTypeError(e.getMessage());
}

final RubyString string = context.getRuntime().newString(new ByteList(result.getOutput(), 0, result.getOutputLength()));

0 comments on commit 385b961

Please sign in to comment.