diff options
author | Stephen Gutekanst <stephen.gutekanst@gmail.com> | 2015-01-18 19:32:15 -0700 |
---|---|---|
committer | Dmitri Shuralyov <shurcooL@gmail.com> | 2015-02-21 18:51:43 -0800 |
commit | 8d4d3fa976191761bc277e2a456d625030a217f6 (patch) | |
tree | 28853e561293cac6f754c4f755cb2cc4ca144f47 | |
parent | d32a1ccb7576c75e030f786e1754b6459e6bfed6 (diff) | |
download | glfw-8d4d3fa976191761bc277e2a456d625030a217f6.tar.gz |
Rename GLFWError to just Error.
This is much more idiomatic, as the user will read it as `glfw3.Error`
rather than `glfw3.GLFWError`.
-rw-r--r-- | error.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -29,8 +29,8 @@ const ( FormatUnavailable ErrorCode = C.GLFW_FORMAT_UNAVAILABLE // The clipboard did not contain data in the requested format. ) -// GLFWError holds error code and description. -type GLFWError struct { +// Error holds error code and description. +type Error struct { Code ErrorCode Desc string } @@ -39,12 +39,12 @@ type GLFWError struct { // See: https://github.com/go-gl/glfw3/pull/86 // Holds the value of the last error. -var lastError = make(chan *GLFWError, 1) +var lastError = make(chan *Error, 1) //export goErrorCB func goErrorCB(code C.int, desc *C.char) { flushErrors() - err := &GLFWError{ErrorCode(code), C.GoString(desc)} + err := &Error{ErrorCode(code), C.GoString(desc)} select { case lastError <- err: default: @@ -54,7 +54,7 @@ func goErrorCB(code C.int, desc *C.char) { } // Error prints the error code and description in a readable format. -func (e *GLFWError) Error() string { +func (e *Error) Error() string { return fmt.Sprintf("Error %d: %s", e.Code, e.Desc) } |