瀏覽代碼

improve errors when openal fails to initialize

Sasha Szpakowski 1 年之前
父節點
當前提交
1e2696b403
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/modules/audio/openal/Audio.cpp

+ 3 - 3
src/modules/audio/openal/Audio.cpp

@@ -145,10 +145,10 @@ Audio::Audio()
 		context = alcCreateContext(device, attribs.data());
 
 		if (context == nullptr)
-			throw love::Exception("Could not create context.");
+			throw love::Exception("Could not create context: %s", alcGetString(device, alcGetError(device)));
 
-		if (!alcMakeContextCurrent(context) || alcGetError(device) != ALC_NO_ERROR)
-			throw love::Exception("Could not make context current.");
+		if (!alcMakeContextCurrent(context))
+			throw love::Exception("Could not make context current: %s", alcGetString(device, alcGetError(device)));
 	}
 
 #ifdef ALC_EXT_EFX