Remove a left-over assignment
[openal-soft.git] / common / alassert.cpp
blobaa44841e428b6dad62a5dc6aa7bab7a4e5d33fed
2 #include "alassert.h"
4 #include <stdexcept>
5 #include <string>
7 namespace {
9 [[noreturn]]
10 void throw_error(const std::string &message)
12 throw std::runtime_error{message};
15 } /* namespace */
17 namespace al {
19 [[noreturn]]
20 void do_assert(const char *message, int linenum, const char *filename, const char *funcname) noexcept
22 /* Throwing an exception that tries to leave a noexcept function will
23 * hopefully cause the system to provide info about the caught exception in
24 * an error dialog. At least on Linux, this results in the process printing
26 * terminate called after throwing an instance of 'std::runtime_error'
27 * what(): <message here>
29 * before terminating from a SIGABRT. Hopefully Windows and Mac will do the
30 * appropriate things with the message to alert the user about an abnormal
31 * termination.
33 auto errstr = std::string{filename};
34 errstr += ':';
35 errstr += std::to_string(linenum);
36 errstr += ": ";
37 errstr += funcname;
38 errstr += ": ";
39 errstr += message;
41 throw_error(errstr);
44 } /* namespace al */