Skip to content

Commit 385b961

Browse files
committed
[Truffle] JRuby pack exceptions.
1 parent 4cdf24d commit 385b961

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

core/src/main/java/org/jruby/RubyArray.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,8 +4105,7 @@ public RubyString pack(ThreadContext context, IRubyObject obj) {
41054105
try {
41064106
packer = context.getRuntime().getTrufflePackBridge().compileFormat(iFmt.toString());
41074107
} catch (FormatException e) {
4108-
throw new UnsupportedOperationException();
4109-
//throw new RaiseException(getContext().getCoreLibrary().argumentError(e.getMessage(), this));
4108+
throw context.getRuntime().newArgumentError(e.getMessage());
41104109
}
41114110

41124111
// 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) {
41184117
try {
41194118
result = packer.pack(values, realLength);
41204119
} catch (TooFewArgumentsException e) {
4121-
throw new UnsupportedOperationException();
4122-
//throw new RaiseException(getContext().getCoreLibrary().argumentError("too few arguments", this));
4120+
throw context.getRuntime().newArgumentError("too few arguments");
41234121
} catch (NoImplicitConversionException e) {
4124-
throw new UnsupportedOperationException();
41254122
//throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(e.getObject(), e.getTarget(), this));
4123+
throw context.getRuntime().newTypeError("todo");
41264124
} catch (OutsideOfStringException e) {
4127-
throw new UnsupportedOperationException();
4128-
//throw new RaiseException(getContext().getCoreLibrary().argumentError("X outside of string", this));
4125+
throw context.getRuntime().newArgumentError("X outside of string");
41294126
} catch (CantCompressNegativeException e) {
4130-
throw new UnsupportedOperationException();
4131-
//throw new RaiseException(getContext().getCoreLibrary().argumentError("can't compress negative numbers", this));
4127+
throw context.getRuntime().newArgumentError("can't compress negative numbers");
41324128
} catch (RangeException e) {
4133-
throw new UnsupportedOperationException();
4134-
//throw new RaiseException(getContext().getCoreLibrary().rangeError(e.getMessage(), this));
4129+
throw context.getRuntime().newRangeError(e.getMessage());
41354130
} catch (CantConvertException e) {
4136-
throw new UnsupportedOperationException();
4137-
//throw new RaiseException(getContext().getCoreLibrary().typeError(e.getMessage(), this));
4131+
throw context.getRuntime().newTypeError(e.getMessage());
41384132
}
41394133

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

0 commit comments

Comments
 (0)