diff options
Diffstat (limited to 'src/pkg/runtime/error.go')
| -rw-r--r-- | src/pkg/runtime/error.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pkg/runtime/error.go b/src/pkg/runtime/error.go index b6b520cf27..bd70908839 100644 --- a/src/pkg/runtime/error.go +++ b/src/pkg/runtime/error.go @@ -74,6 +74,22 @@ func newErrorString(s string, ret *interface{}) { *ret = errorString(s) } +// An errorCString represents a runtime error described by a single C string. +type errorCString uintptr + +func (e errorCString) RuntimeError() {} + +func cstringToGo(uintptr) string + +func (e errorCString) Error() string { + return "runtime error: " + cstringToGo(uintptr(e)) +} + +// For calling from C. +func newErrorCString(s uintptr, ret *interface{}) { + *ret = errorCString(s) +} + type stringer interface { String() string } |
