Permalink
Browse files

Merge pull request #278 from kachick/fix/error-message-in_Struct

fix some error message in Struct#[]
  • Loading branch information...
2 parents 4381bc2 + 17fa907 commit 5e1ea4ac378e37eb1a5c1e056aa061e08d75655b @headius headius committed Sep 29, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 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) {
@@ -623,9 +623,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];
@@ -642,9 +642,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();

0 comments on commit 5e1ea4a

Please sign in to comment.