aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/error.go')
-rw-r--r--libgo/go/runtime/error.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/libgo/go/runtime/error.go b/libgo/go/runtime/error.go
index c4621b6..b9c7365 100644
--- a/libgo/go/runtime/error.go
+++ b/libgo/go/runtime/error.go
@@ -101,11 +101,6 @@ func (e errorString) Error() string {
return "runtime error: " + string(e)
}
-// For calling from C.
-func NewErrorString(s string, ret *interface{}) {
- *ret = errorString(s)
-}
-
// An errorCString represents a runtime error described by a single C string.
// Not "type errorCString uintptr" because of http://golang.org/issue/7084.
type errorCString struct{ cstr uintptr }
@@ -123,6 +118,17 @@ func NewErrorCString(s uintptr, ret *interface{}) {
*ret = errorCString{s}
}
+// plainError represents a runtime error described a string without
+// the prefix "runtime error: " after invoking errorString.Error().
+// See Issue #14965.
+type plainError string
+
+func (e plainError) RuntimeError() {}
+
+func (e plainError) Error() string {
+ return string(e)
+}
+
type stringer interface {
String() string
}
@@ -152,5 +158,5 @@ func Printany(i interface{}) {
// called from generated code
func panicwrap(pkg, typ, meth string) {
- panic("value method " + pkg + "." + typ + "." + meth + " called using nil *" + typ + " pointer")
+ panic(plainError("value method " + pkg + "." + typ + "." + meth + " called using nil *" + typ + " pointer"))
}