Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

fix some error message in Struct#[] #278

Merged
merged 1 commit into from Sep 29, 2012
Jump to file or symbol
Failed to load files and symbols.
+5 −5
Split
@@ -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();