Permission: throw exception instead of raising fatal error

This commit is contained in:
Max Kellermann
2017-08-11 09:33:59 +02:00
parent 85edcb858d
commit e8333316ee

View File

@@ -22,7 +22,7 @@
#include "config/Param.hxx" #include "config/Param.hxx"
#include "config/ConfigGlobal.hxx" #include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx" #include "config/ConfigOption.hxx"
#include "system/FatalError.hxx" #include "util/RuntimeError.hxx"
#include <algorithm> #include <algorithm>
#include <map> #include <map>
@@ -56,7 +56,7 @@ ParsePermission(const char *p)
if (strcmp(p, i->name) == 0) if (strcmp(p, i->name) == 0)
return i->value; return i->value;
FormatFatalError("unknown permission \"%s\"", p); throw FormatRuntimeError("unknown permission \"%s\"", p);
} }
static unsigned parsePermissions(const char *string) static unsigned parsePermissions(const char *string)
@@ -102,11 +102,11 @@ void initPermissions(void)
PERMISSION_PASSWORD_CHAR); PERMISSION_PASSWORD_CHAR);
if (separator == NULL) if (separator == NULL)
FormatFatalError("\"%c\" not found in password string " throw FormatRuntimeError("\"%c\" not found in password string "
"\"%s\", line %i", "\"%s\", line %i",
PERMISSION_PASSWORD_CHAR, PERMISSION_PASSWORD_CHAR,
param->value.c_str(), param->value.c_str(),
param->line); param->line);
std::string password(param->value.c_str(), separator); std::string password(param->value.c_str(), separator);