diff options
author | Chris Robinson <[email protected]> | 2023-04-30 04:22:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-04-30 04:22:13 -0700 |
commit | b64b500c6b75aebb3b5d1c41206317f81636a21c (patch) | |
tree | 92271958a92c1b37b47a9ebb0d098aabee065661 | |
parent | 622ee190efffef9407ff63ffdbff6bbdbe0dce04 (diff) |
Improve some debug error handling
-rw-r--r-- | al/debug.cpp | 8 | ||||
-rw-r--r-- | alc/context.cpp | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/al/debug.cpp b/al/debug.cpp index 5d01fda9..98c5a0b5 100644 --- a/al/debug.cpp +++ b/al/debug.cpp @@ -120,13 +120,13 @@ FORCE_ALIGN void AL_APIENTRY alDebugMessageControlSOFT(ALenum source, ALenum typ if(!ids) return context->setError(AL_INVALID_VALUE, "IDs is null with non-0 count"); if(source == AL_DONT_CARE_SOFT) - return context->setError(AL_INVALID_VALUE, + return context->setError(AL_INVALID_OPERATION, "Debug source cannot be AL_DONT_CARE_SOFT with IDs"); if(type == AL_DONT_CARE_SOFT) - return context->setError(AL_INVALID_VALUE, + return context->setError(AL_INVALID_OPERATION, "Debug type cannot be AL_DONT_CARE_SOFT with IDs"); if(severity != AL_DONT_CARE_SOFT) - return context->setError(AL_INVALID_VALUE, + return context->setError(AL_INVALID_OPERATION, "Debug severity must be AL_DONT_CARE_SOFT with IDs"); return context->setError(AL_INVALID_VALUE, "Debug ID filtering not supported"); @@ -134,7 +134,7 @@ FORCE_ALIGN void AL_APIENTRY alDebugMessageControlSOFT(ALenum source, ALenum typ } if(enable != AL_TRUE && enable != AL_FALSE) - return context->setError(AL_INVALID_VALUE, "Invalid debug enable %d", enable); + return context->setError(AL_INVALID_ENUM, "Invalid debug enable %d", enable); static constexpr size_t ElemCount{DebugSourceCount + DebugTypeCount + DebugSeverityCount}; static constexpr auto Values = make_array<uint,ElemCount>(); diff --git a/alc/context.cpp b/alc/context.cpp index 7fcb6539..6553f322 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -304,7 +304,7 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, DebugSeverity severity, ALsizei length, const char *message) { static_assert(DebugSeverityBase+DebugSeverityCount <= 32, "Too many debug bits"); - static auto get_source_enum = [](DebugSource source) noexcept + static auto get_source_enum = [](DebugSource source) { switch(source) { @@ -314,8 +314,9 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, case DebugSource::Application: return AL_DEBUG_SOURCE_APPLICATION_SOFT; case DebugSource::Other: return AL_DEBUG_SOURCE_OTHER_SOFT; } + throw std::runtime_error{"Unexpected debug source value "+std::to_string(al::to_underlying(source))}; }; - static auto get_type_enum = [](DebugType type) noexcept + static auto get_type_enum = [](DebugType type) { switch(type) { @@ -327,8 +328,9 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, case DebugType::Marker: return AL_DEBUG_TYPE_MARKER_SOFT; case DebugType::Other: return AL_DEBUG_TYPE_OTHER_SOFT; } + throw std::runtime_error{"Unexpected debug type value "+std::to_string(al::to_underlying(type))}; }; - static auto get_severity_enum = [](DebugSeverity severity) noexcept + static auto get_severity_enum = [](DebugSeverity severity) { switch(severity) { @@ -337,6 +339,7 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, case DebugSeverity::Low: return AL_DEBUG_SEVERITY_LOW_SOFT; case DebugSeverity::Notification: return AL_DEBUG_SEVERITY_NOTIFICATION_SOFT; } + throw std::runtime_error{"Unexpected debug severity value "+std::to_string(al::to_underlying(severity))}; }; std::lock_guard<std::mutex> _{mDebugCbLock}; |