aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/gob/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/gob/error.go')
-rw-r--r--src/pkg/gob/error.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/pkg/gob/error.go b/src/pkg/gob/error.go
index 106543d736..b0c40086d5 100644
--- a/src/pkg/gob/error.go
+++ b/src/pkg/gob/error.go
@@ -4,10 +4,7 @@
package gob
-import (
- "fmt"
- "os"
-)
+import "fmt"
// Errors in decoding and encoding are handled using panic and recover.
// Panics caused by user error (that is, everything except run-time panics
@@ -18,23 +15,23 @@ import (
// A gobError wraps an os.Error and is used to distinguish errors (panics) generated in this package.
type gobError struct {
- err os.Error
+ err error
}
// errorf is like error but takes Printf-style arguments to construct an os.Error.
// It always prefixes the message with "gob: ".
func errorf(format string, args ...interface{}) {
- error(fmt.Errorf("gob: "+format, args...))
+ error_(fmt.Errorf("gob: "+format, args...))
}
// error wraps the argument error and uses it as the argument to panic.
-func error(err os.Error) {
+func error_(err error) {
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) {
+func catchError(err *error) {
if e := recover(); e != nil {
*err = e.(gobError).err // Will re-panic if not one of our errors, such as a runtime error.
}