Emscripten: Added missing error messages for audio and joystick init failures.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 05 Aug 2015 21:04:10 +0200
changeset 9831 6c7e2f0747f7
parent 9830 0ada01db0923
child 9832 5fa8cf552d05
Emscripten: Added missing error messages for audio and joystick init failures.
src/audio/emscripten/SDL_emscriptenaudio.c
src/joystick/emscripten/SDL_sysjoystick.c
--- a/src/audio/emscripten/SDL_emscriptenaudio.c	Wed Aug 05 21:03:31 2015 +0200
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c	Wed Aug 05 21:04:10 2015 +0200
@@ -263,6 +263,10 @@
         return 0;
     });
 
+    if (!available) {
+        SDL_SetError("No audio context available");
+    }
+
     return available;
 }
 
--- a/src/joystick/emscripten/SDL_sysjoystick.c	Wed Aug 05 21:03:31 2015 +0200
+++ b/src/joystick/emscripten/SDL_sysjoystick.c	Wed Aug 05 21:04:10 2015 +0200
@@ -200,6 +200,7 @@
 
     /* Check if gamepad is supported by browser */
     if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
+        SDL_SetError("Gamepads not supported");
         return -1;
     }
 
@@ -221,6 +222,7 @@
 
     if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
         SDL_SYS_JoystickQuit();
+        SDL_SetError("Could not set gamepad connect callback");
         return -1;
     }
 
@@ -229,6 +231,7 @@
                                                          Emscripten_JoyStickDisconnected);
     if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
         SDL_SYS_JoystickQuit();
+        SDL_SetError("Could not set gamepad disconnect callback");
         return -1;
     }