as2js: /home/snapwebsites/snapcpp/contrib/as2js/include/as2js/exceptions.h Source File

exceptions.h
Go to the documentation of this file.
1 #ifndef AS2JS_EXCEPTIONS_H
2 #define AS2JS_EXCEPTIONS_H
3 /* include/as2js/exceptions.h
4 
5 Copyright (c) 2005-2019 Made to Order Software Corp. All Rights Reserved
6 
8 
9 Permission is hereby granted, free of charge, to any
10 person obtaining a copy of this software and
11 associated documentation files (the "Software"), to
12 deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify,
14 merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom
16 the Software is furnished to do so, subject to the
17 following conditions:
18 
19 The above copyright notice and this permission notice
20 shall be included in all copies or substantial
21 portions of the Software.
22 
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
24 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
25 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
26 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
27 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30 ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 SOFTWARE.
33 
34 */
35 
36 #include <stdexcept>
37 
38 
39 namespace as2js
40 {
41 
42 class exception_internal_error : public std::logic_error
43 {
44 public:
45  exception_internal_error(char const *msg) : logic_error(msg) {}
46  exception_internal_error(std::string const& msg) : logic_error(msg) {}
47 };
48 
49 
50 class exception_exit : public std::runtime_error
51 {
52 public:
53  exception_exit(int exit_code, char const *msg) : runtime_error(msg), f_exit_code(exit_code) {}
54  exception_exit(int exit_code, std::string const& msg) : runtime_error(msg), f_exit_code(exit_code) {}
55 
56  int get_exit_code() const { return f_exit_code; }
57 
58 private:
59  int const f_exit_code;
60 };
61 
62 
63 class exception_locked_node : public std::runtime_error
64 {
65 public:
66  exception_locked_node(char const *msg) : runtime_error(msg) {}
67  exception_locked_node(std::string const& msg) : runtime_error(msg) {}
68 };
69 
70 
71 class exception_invalid_float : public std::runtime_error
72 {
73 public:
74  exception_invalid_float(char const *msg) : runtime_error(msg) {}
75  exception_invalid_float(std::string const& msg) : runtime_error(msg) {}
76 };
77 
78 
79 class exception_invalid_index : public std::runtime_error
80 {
81 public:
82  exception_invalid_index(char const *msg) : runtime_error(msg) {}
83  exception_invalid_index(std::string const& msg) : runtime_error(msg) {}
84 };
85 
86 
87 class exception_incompatible_node_type : public std::runtime_error
88 {
89 public:
90  exception_incompatible_node_type(char const *msg) : runtime_error(msg) {}
91  exception_incompatible_node_type(std::string const& msg) : runtime_error(msg) {}
92 };
93 
94 
95 class exception_incompatible_node_data : public std::runtime_error
96 {
97 public:
98  exception_incompatible_node_data(char const *msg) : runtime_error(msg) {}
99  exception_incompatible_node_data(std::string const& msg) : runtime_error(msg) {}
100 };
101 
102 
103 class exception_invalid_data : public std::runtime_error
104 {
105 public:
106  exception_invalid_data(char const *msg) : runtime_error(msg) {}
107  exception_invalid_data(std::string const& msg) : runtime_error(msg) {}
108 };
109 
110 
111 class exception_already_defined : public std::runtime_error
112 {
113 public:
114  exception_already_defined(char const *msg) : runtime_error(msg) {}
115  exception_already_defined(std::string const& msg) : runtime_error(msg) {}
116 };
117 
118 
119 class exception_no_parent : public std::runtime_error
120 {
121 public:
122  exception_no_parent(char const *msg) : runtime_error(msg) {}
123  exception_no_parent(std::string const& msg) : runtime_error(msg) {}
124 };
125 
126 
127 class exception_index_out_of_range : public std::out_of_range
128 {
129 public:
130  exception_index_out_of_range(char const *msg) : out_of_range(msg) {}
131  exception_index_out_of_range(std::string const& msg) : out_of_range(msg) {}
132 };
133 
134 
135 class exception_cannot_open_file : public std::runtime_error
136 {
137 public:
138  exception_cannot_open_file(char const *msg) : runtime_error(msg) {}
139  exception_cannot_open_file(std::string const& msg) : runtime_error(msg) {}
140 };
141 
142 
143 class exception_file_already_open : public std::logic_error
144 {
145 public:
146  exception_file_already_open(char const *msg) : logic_error(msg) {}
147  exception_file_already_open(std::string const& msg) : logic_error(msg) {}
148 };
149 
150 
151 class exception_cyclical_structure : public std::logic_error
152 {
153 public:
154  exception_cyclical_structure(char const *msg) : logic_error(msg) {}
155  exception_cyclical_structure(std::string const& msg) : logic_error(msg) {}
156 };
157 
158 
159 }
160 // namespace as2js
161 #endif
162 // #ifndef AS2JS_AS_H
163 
164 // vim: ts=4 sw=4 et
exception_index_out_of_range(std::string const &msg)
Definition: exceptions.h:131
exception_cannot_open_file(std::string const &msg)
Definition: exceptions.h:139
exception_file_already_open(char const *msg)
Definition: exceptions.h:146
exception_exit(int exit_code, std::string const &msg)
Definition: exceptions.h:54
exception_locked_node(char const *msg)
Definition: exceptions.h:66
exception_already_defined(char const *msg)
Definition: exceptions.h:114
exception_no_parent(char const *msg)
Definition: exceptions.h:122
exception_invalid_index(char const *msg)
Definition: exceptions.h:82
exception_internal_error(char const *msg)
Definition: exceptions.h:45
exception_invalid_data(std::string const &msg)
Definition: exceptions.h:107
exception_cyclical_structure(std::string const &msg)
Definition: exceptions.h:155
exception_incompatible_node_type(char const *msg)
Definition: exceptions.h:90
exception_incompatible_node_data(std::string const &msg)
Definition: exceptions.h:99
exception_no_parent(std::string const &msg)
Definition: exceptions.h:123
exception_cannot_open_file(char const *msg)
Definition: exceptions.h:138
int const f_exit_code
Definition: exceptions.h:59
exception_locked_node(std::string const &msg)
Definition: exceptions.h:67
exception_internal_error(std::string const &msg)
Definition: exceptions.h:46
exception_incompatible_node_data(char const *msg)
Definition: exceptions.h:98
exception_file_already_open(std::string const &msg)
Definition: exceptions.h:147
exception_invalid_data(char const *msg)
Definition: exceptions.h:106
exception_invalid_float(char const *msg)
Definition: exceptions.h:74
exception_cyclical_structure(char const *msg)
Definition: exceptions.h:154
exception_exit(int exit_code, char const *msg)
Definition: exceptions.h:53
exception_invalid_float(std::string const &msg)
Definition: exceptions.h:75
exception_invalid_index(std::string const &msg)
Definition: exceptions.h:83
The AlexScript to JavaScript namespace.
Definition: compiler.cpp:37
exception_index_out_of_range(char const *msg)
Definition: exceptions.h:130
exception_incompatible_node_type(std::string const &msg)
Definition: exceptions.h:91
exception_already_defined(std::string const &msg)
Definition: exceptions.h:115
int get_exit_code() const
Definition: exceptions.h:56

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly