From 02d80cd74dd7b4517550af2f4ea22c409323a1d9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 7 Oct 2019 21:37:56 -0700 Subject: Use exceptions for backend open failures --- alc/backends/null.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'alc/backends/null.cpp') diff --git a/alc/backends/null.cpp b/alc/backends/null.cpp index b6b115f1..aca59605 100644 --- a/alc/backends/null.cpp +++ b/alc/backends/null.cpp @@ -31,6 +31,7 @@ #include #include "alcmain.h" +#include "alexcpt.h" #include "almalloc.h" #include "alu.h" #include "logging.h" @@ -51,7 +52,7 @@ struct NullBackend 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; @@ -108,16 +109,14 @@ int NullBackend::mixerProc() } -ALCenum NullBackend::open(const ALCchar *name) +void NullBackend::open(const ALCchar *name) { if(!name) name = nullDevice; else if(strcmp(name, nullDevice) != 0) - return ALC_INVALID_VALUE; + throw al::backend_exception{ALC_INVALID_VALUE, "Device name \"%s\" not found", name}; mDevice->DeviceName = name; - - return ALC_NO_ERROR; } bool NullBackend::reset() -- cgit v1.2.3