diff options
author | Chris Robinson <[email protected]> | 2019-10-07 21:37:56 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-10-07 21:37:56 -0700 |
commit | 02d80cd74dd7b4517550af2f4ea22c409323a1d9 (patch) | |
tree | f72a927a6565d76dc7087f1a15f82733d92b4155 /alc/backends/solaris.cpp | |
parent | f8ff4e269bf04aae1c430dbb218b4f4f6605df45 (diff) |
Use exceptions for backend open failures
Diffstat (limited to 'alc/backends/solaris.cpp')
-rw-r--r-- | alc/backends/solaris.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp index 128924bb..5963a4b2 100644 --- a/alc/backends/solaris.cpp +++ b/alc/backends/solaris.cpp @@ -39,6 +39,7 @@ #include <functional> #include "alcmain.h" +#include "alexcpt.h" #include "alu.h" #include "alconfig.h" #include "threads.h" @@ -61,7 +62,7 @@ struct SolarisBackend final : public BackendBase { int mixerProc(); - ALCenum open(const ALCchar *name) override; + void open(const ALCchar *name) override; bool reset() override; bool start() override; void stop() override; @@ -142,22 +143,22 @@ int SolarisBackend::mixerProc() } -ALCenum SolarisBackend::open(const ALCchar *name) +void SolarisBackend::open(const ALCchar *name) { if(!name) name = solaris_device; else if(strcmp(name, solaris_device) != 0) - return ALC_INVALID_VALUE; + throw al::backend_exception{ALC_INVALID_VALUE, "Device name \"%s\" not found", name}; mFd = ::open(solaris_driver.c_str(), O_WRONLY); if(mFd == -1) { ERR("Could not open %s: %s\n", solaris_driver.c_str(), strerror(errno)); - return ALC_INVALID_VALUE; + throw al::backend_exception{ALC_INVALID_VALUE, "Could not open %s: %s", + solaris_driver.c_str(), strerror(errno)}; } mDevice->DeviceName = name; - return ALC_NO_ERROR; } bool SolarisBackend::reset() |