Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix error message in Struct#[]

  • Loading branch information...
commit 17fa9079cc34cc086188b9319554ba4fab3e0d24 1 parent b247119
@kachick kachick authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/org/jruby/RubyStruct.java
View
10 src/org/jruby/RubyStruct.java
@@ -471,7 +471,7 @@ public IRubyObject set(IRubyObject value, int index) {
}
private RaiseException notStructMemberError(String name) {
- return getRuntime().newNameError(name + " is not struct member", name);
+ return getRuntime().newNameError("no member '" + name + "' in struct", name);
}
public IRubyObject get(int index) {
@@ -624,9 +624,9 @@ public IRubyObject aref(IRubyObject key) {
idx = idx < 0 ? values.length + idx : idx;
if (idx < 0) {
- throw getRuntime().newIndexError("offset " + idx + " too large for struct (size:" + values.length + ")");
+ throw getRuntime().newIndexError("offset " + idx + " too small for struct(size:" + values.length + ")");
} else if (idx >= values.length) {
- throw getRuntime().newIndexError("offset " + idx + " too large for struct (size:" + values.length + ")");
+ throw getRuntime().newIndexError("offset " + idx + " too large for struct(size:" + values.length + ")");
}
return values[idx];
@@ -643,9 +643,9 @@ public IRubyObject aset(IRubyObject key, IRubyObject value) {
idx = idx < 0 ? values.length + idx : idx;
if (idx < 0) {
- throw getRuntime().newIndexError("offset " + idx + " too large for struct (size:" + values.length + ")");
+ throw getRuntime().newIndexError("offset " + idx + " too small for struct(size:" + values.length + ")");
} else if (idx >= values.length) {
- throw getRuntime().newIndexError("offset " + idx + " too large for struct (size:" + values.length + ")");
+ throw getRuntime().newIndexError("offset " + idx + " too large for struct(size:" + values.length + ")");
}
modify();
Please sign in to comment.
Something went wrong with that request. Please try again.