aboutsummaryrefslogtreecommitdiff
path: root/src/confighandlerexception.cpp
blob: b7913c8d62542d734b0589da172dac4155845cdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "confighandlerexception.h"

#include <cassert>

#include "config.h"
#include "configparser.h"

namespace newsboat {

ConfigHandlerException::ConfigHandlerException(ActionHandlerStatus e)
{
	msg = get_errmsg(e);
}

const char* ConfigHandlerException::get_errmsg(ActionHandlerStatus status)
{
	switch (status) {
	case ActionHandlerStatus::INVALID_PARAMS:
		return _("invalid parameters.");
	case ActionHandlerStatus::TOO_FEW_PARAMS:
		return _("too few parameters.");
	case ActionHandlerStatus::TOO_MANY_PARAMS:
		return _("too many parameters.");
	case ActionHandlerStatus::INVALID_COMMAND:
		return _("unknown command (bug).");
	case ActionHandlerStatus::FILENOTFOUND:
		return _("file couldn't be opened.");
	}

	assert(0 && "unreachable, because the switch() above handles everything");
}

} // namespace newsboat