CARDS 2.4.87
Package manager for the NuTyX GNU/Linux distribution
error_treat.h
1 //
2 // error_treat.h
3 //
4 // Copyright (c) 2014-2017 by NuTyX team (http://nutyx.org)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20 //
21 
22 #ifndef ERRORTREAT_H
23 #define ERRORTREAT_H
24 
25 #include "system_utils.h"
26 
27 #include <cstring>
28 
29 #define RED "\033[1;31m"
30 #define GREEN "\033[1;32m"
31 #define YELLOW "\033[1;33m"
32 #define BLUE "\033[1;34m"
33 #define MAGENTA "\033[1;35m"
34 #define CYAN "\033[1;36m"
35 #define WHITE "\033[1;37m"
36 #define NORMAL "\033[1;0m"
37 
38 #define ACTION _("\033[1;33maction:\033[1;0m")
39 #define USAGE _("\033[1;33musage: \033[1;0m")
40 #define OPTIONS _("\033[1;33moptions\033[1;0m")
41 #define REQUIRED _("\033[1;33mrequired\033[1;0m")
42 #define DESCRIPTION _("\033[1;33mdescription: \033[1;0m")
43 #define COMMAND _("\033[1;34mcommand\033[1;0m")
44 
45 
46 enum error
47 {
48 CANNOT_DOWNLOAD_FILE,
49 CANNOT_CREATE_FILE,
50 CANNOT_OPEN_FILE,
51 CANNOT_FIND_FILE,
52 CANNOT_READ_FILE,
53 CANNOT_COPY_FILE,
54 CANNOT_PARSE_FILE,
55 CANNOT_READ_DIRECTORY,
56 CANNOT_WRITE_FILE,
57 CANNOT_SYNCHRONIZE,
58 CANNOT_RENAME_FILE,
59 CANNOT_DETERMINE_NAME_BUILDNR,
60 WRONG_ARCHITECTURE,
61 EMPTY_PACKAGE,
62 CANNOT_FORK,
63 WAIT_PID_FAILED,
64 DATABASE_LOCKED,
65 CANNOT_LOCK_DIRECTORY,
66 CANNOT_REMOVE_FILE,
67 CANNOT_CREATE_DIRECTORY,
68 CANNOT_RENAME_DIRECTORY,
69 OPTION_ONE_ARGUMENT,
70 INVALID_OPTION,
71 OPTION_MISSING,
72 TOO_MANY_OPTIONS,
73 ONLY_ROOT_CAN_INSTALL_UPGRADE_REMOVE,
74 PACKAGE_NOT_FOUND,
75 PACKAGE_ALLREADY_INSTALL,
76 PACKAGE_NOT_INSTALL,
77 PACKAGE_NOT_PREVIOUSLY_INSTALL,
78 LISTED_FILES_ALLREADY_INSTALLED,
79 PKGADD_CONFIG_LINE_TOO_LONG,
80 PKGADD_CONFIG_WRONG_NUMBER_ARGUMENTS,
81 PKGADD_CONFIG_UNKNOWN_ACTION,
82 PKGADD_CONFIG_UNKNOWN_EVENT,
83 CANNOT_COMPILE_REGULAR_EXPRESSION,
84 CANNOT_GENERATE_LEVEL,
85 NOT_INSTALL_PACKAGE_NEITHER_PACKAGE_FILE
86 };
87 
88 class RunTimeErrorWithErrno : public std::runtime_error
89 {
90  public:
91  explicit RunTimeErrorWithErrno(const std::string& msg) throw();
92  explicit RunTimeErrorWithErrno(const std::string& msg, int e) throw();
93 };
94 #endif /* ERRORTREAT_H */
95 // vim:set ts=2 :
Definition: error_treat.h:88