File: errors.cc

package info (click to toggle)
snapper 0.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,576 kB
  • ctags: 2,049
  • sloc: cpp: 15,605; sh: 11,424; ansic: 1,401; makefile: 287; python: 159
file content (91 lines) | stat: -rw-r--r-- 2,368 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Copyright (c) [2011-2014] Novell, Inc.
 *
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as published
 * by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, contact Novell, Inc.
 *
 * To contact Novell about this file by physical or electronic mail, you may
 * find current contact information at www.novell.com.
 */


#include <snapper/AppUtil.h>

#include "utils/text.h"

#include "errors.h"


using namespace std;
using namespace snapper;


string
error_description(const DBus::ErrorException& e)
{
    string name = e.name();

    if (name == "error.unknown_config")
	return _("Unknown config.");

    if (name == "error.no_permissions")
	return _("No permissions.");

    if (name == "error.invalid_userdata")
	return _("Invalid userdata.");

    if (name == "error.invalid_configdata")
	return _("Invalid configdata.");

    if (name == "error.illegal_snapshot")
	return _("Illegal Snapshot.");

    if (name == "error.config_locked")
	return _("Config is locked.");

    if (name == "error.config_in_use")
	return _("Config is in use.");

    if (name == "error.snapshot_in_use")
	return _("Snapshot is in use.");

    if (name == "error.unknown_file")
	return _("Unknown file.");

    if (name == "error.io_error")
	return _("IO Error.");

    if (name == "error.create_config_failed")
	return sformat(_("Creating config failed (%s)."), e.message());

    if (name == "error.delete_config_failed")
	return sformat(_("Deleting config failed (%s)."), e.message());

    if (name == "error.create_snapshot_failed")
	return _("Creating snapshot failed.");

    if (name == "error.delete_snapshot_failed")
	return _("Deleting snapshot failed.");

    if (name == "error.invalid_user")
	return _("Invalid user.");

    if (name == "error.invalid_group")
	return _("Invalid group.");

    if (name == "error.acl_error")
	return _("ACL error.");

    return sformat(_("Failure (%s)."), name.c_str());
}