diff options
Diffstat (limited to 'src/pkg/runtime/error.go')
-rw-r--r-- | src/pkg/runtime/error.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pkg/runtime/error.go b/src/pkg/runtime/error.go index 6c37f888f..4b0ee4931 100644 --- a/src/pkg/runtime/error.go +++ b/src/pkg/runtime/error.go @@ -6,11 +6,11 @@ package runtime // The Error interface identifies a run time error. type Error interface { - String() string + error // RuntimeError is a no-op function but // serves to distinguish types that are runtime - // errors from ordinary os.Errors: a type is a + // errors from ordinary errors: a type is a // runtime error if it has a RuntimeError method. RuntimeError() } @@ -28,7 +28,7 @@ type TypeAssertionError struct { func (*TypeAssertionError) RuntimeError() {} -func (e *TypeAssertionError) String() string { +func (e *TypeAssertionError) Error() string { inter := e.interfaceString if inter == "" { inter = "interface" @@ -98,7 +98,7 @@ type errorString string func (e errorString) RuntimeError() {} -func (e errorString) String() string { +func (e errorString) Error() string { return "runtime error: " + string(e) } @@ -123,6 +123,8 @@ func printany(i interface{}) { print("nil") case stringer: print(v.String()) + case error: + print(v.Error()) case int: print(v) case string: |