CARDS 2.4.121
Package manager for the NuTyX GNU/Linux distribution
error_treat.h
1 //
2 // error_treat.h
3 //
4 // Copyright (c) 2014 - 2020 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_FIND_DEPOT,
49 CANNOT_DOWNLOAD_FILE,
50 CANNOT_CREATE_FILE,
51 CANNOT_OPEN_FILE,
52 CANNOT_FIND_FILE,
53 CANNOT_READ_FILE,
54 CANNOT_COPY_FILE,
55 CANNOT_PARSE_FILE,
56 CANNOT_READ_DIRECTORY,
57 CANNOT_WRITE_FILE,
58 CANNOT_SYNCHRONIZE,
59 CANNOT_RENAME_FILE,
60 CANNOT_DETERMINE_NAME_BUILDNR,
61 WRONG_ARCHITECTURE,
62 EMPTY_PACKAGE,
63 CANNOT_FORK,
64 WAIT_PID_FAILED,
65 DATABASE_LOCKED,
66 CANNOT_LOCK_DIRECTORY,
67 CANNOT_REMOVE_FILE,
68 CANNOT_CREATE_DIRECTORY,
69 CANNOT_RENAME_DIRECTORY,
70 OPTION_ONE_ARGUMENT,
71 INVALID_OPTION,
72 OPTION_MISSING,
73 TOO_MANY_OPTIONS,
74 ONLY_ROOT_CAN_INSTALL_UPGRADE_REMOVE,
75 PACKAGE_NOT_EXIST,
76 PACKAGE_NOT_FOUND,
77 PACKAGE_ALLREADY_INSTALL,
78 PACKAGE_NOT_INSTALL,
79 PACKAGE_NOT_PREVIOUSLY_INSTALL,
80 LISTED_FILES_ALLREADY_INSTALLED,
81 PKGADD_CONFIG_LINE_TOO_LONG,
82 PKGADD_CONFIG_WRONG_NUMBER_ARGUMENTS,
83 PKGADD_CONFIG_UNKNOWN_ACTION,
84 PKGADD_CONFIG_UNKNOWN_EVENT,
85 CANNOT_COMPILE_REGULAR_EXPRESSION,
86 CANNOT_GENERATE_LEVEL,
87 NOT_INSTALL_PACKAGE_NEITHER_PACKAGE_FILE
88 };
89 
90 class RunTimeErrorWithErrno : public std::runtime_error
91 {
92  public:
93  explicit RunTimeErrorWithErrno(const std::string& msg) throw();
94  explicit RunTimeErrorWithErrno(const std::string& msg, int e) throw();
95 };
96 #endif /* ERRORTREAT_H */
97 // vim:set ts=2 :
RunTimeErrorWithErrno
Definition: error_treat.h:91