// plain test.Error call.
func testError(t *testing.T) {
if e := recover(); e != nil {
- t.Error(e.(gobError).Error) // Will re-panic if not one of our errors, such as a runtime error.
+ t.Error(e.(gobError).err) // Will re-panic if not one of our errors, such as a runtime error.
}
return
}
dec.wireType[id] = wire
}
-var errBadCount = gobError{os.NewError("invalid message length")}
+var errBadCount = os.NewError("invalid message length")
// recvMessage reads the next count-delimited item from the input. It is the converse
// of Encoder.writeMessage. It returns false on EOF or other error reading the message.
// A gobError wraps an os.Error and is used to distinguish errors (panics) generated in this package.
type gobError struct {
- os.Error
+ err os.Error
}
// errorf is like error but takes Printf-style arguments to construct an os.Error.
// error wraps the argument error and uses it as the argument to panic.
func error(err os.Error) {
- panic(gobError{Error: err})
+ panic(gobError{err})
}
// catchError is meant to be used as a deferred function to turn a panic(gobError) into a
// plain os.Error. It overwrites the error return of the function that deferred its call.
func catchError(err *os.Error) {
if e := recover(); e != nil {
- *err = e.(gobError).Error // Will re-panic if not one of our errors, such as a runtime error.
+ *err = e.(gobError).err // Will re-panic if not one of our errors, such as a runtime error.
}
return
}