Skip to content

Commit

Permalink
[Truffle] JRuby pack exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 6, 2015
1 parent 4cdf24d commit 385b961
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions core/src/main/java/org/jruby/RubyArray.java
Expand Up @@ -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
Expand All @@ -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()));
Expand Down

0 comments on commit 385b961

Please sign in to comment.