aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-01 21:48:27 -0400
committerRuss Cox <rsc@golang.org>2011-11-01 21:48:27 -0400
commitc14f71c78839f51652d6420fb03b3538914ad062 (patch)
tree0a1381be249fd2ccf8293d633eba244b8ade28ac
parente67d3c44f702639e0be75ca3e69542eeaf62c498 (diff)
downloadgo-c14f71c78839f51652d6420fb03b3538914ad062.tar.gz
go-c14f71c78839f51652d6420fb03b3538914ad062.zip
runtime: update for error
R=golang-dev, iant, r CC=golang-dev https://golang.org/cl/5306075
-rw-r--r--src/pkg/runtime/error.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pkg/runtime/error.go b/src/pkg/runtime/error.go
index 6c37f888f2..13dc52b32a 100644
--- a/src/pkg/runtime/error.go
+++ b/src/pkg/runtime/error.go
@@ -6,7 +6,7 @@ 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
@@ -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: