sdl/error: update errorFromInt() to return generic error if SDL2 doesn't have its own error
@@ -78,9 +78,12 @@ func Unsupported() {
}
// errorFromInt returns GetError() if passed negative value, otherwise it returns nil.
-func errorFromInt(code int) error {
+func errorFromInt(code int) (err error) {
if code < 0 {
- return GetError()
+ err = GetError()
+ if err == nil {
+ err = errors.New("Unknown error (probably using old version of SDL2 and the function called is not supported?)")
}
- return nil
+ }
+ return
}
