File tree Expand file tree Collapse file tree 5 files changed +17
-26
lines changed Expand file tree Collapse file tree 5 files changed +17
-26
lines changed Original file line number Diff line number Diff line change @@ -1867,7 +1867,7 @@ namespace Sass {
1867
1867
// maybe convert to other unit
1868
1868
// easier implemented on its own
1869
1869
try { convert (prefered, strict); }
1870
- catch (incompatibleUnits & err)
1870
+ catch (Exception::IncompatibleUnits & err)
1871
1871
{ error (err.what (), pstate ()); }
1872
1872
catch (...) { throw ; }
1873
1873
Original file line number Diff line number Diff line change @@ -111,7 +111,6 @@ namespace Sass {
111
111
}
112
112
113
113
IncompatibleUnits::IncompatibleUnits (const Number& lhs, const Number& rhs)
114
- : lhs(lhs), rhs(rhs)
115
114
{
116
115
msg = " Incompatible units: '" ;
117
116
msg += rhs.unit ();
@@ -120,6 +119,15 @@ namespace Sass {
120
119
msg += " '." ;
121
120
}
122
121
122
+ IncompatibleUnits::IncompatibleUnits (const UnitType lhs, const UnitType rhs)
123
+ {
124
+ msg = " Incompatible units: '" ;
125
+ msg += unit_to_string (rhs);
126
+ msg += " ' and '" ;
127
+ msg += unit_to_string (lhs);
128
+ msg += " '." ;
129
+ }
130
+
123
131
AlphaChannelsNotEqual::AlphaChannelsNotEqual (Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, const std::string& op)
124
132
: lhs(lhs), rhs(rhs), op(op)
125
133
{
Original file line number Diff line number Diff line change 5
5
#include < sstream>
6
6
#include < stdexcept>
7
7
#include " position.hpp"
8
+ #include " ast_fwd_decl.hpp"
9
+ #include " sass/functions.h"
8
10
9
11
namespace Sass {
10
12
@@ -136,10 +138,11 @@ namespace Sass {
136
138
137
139
class IncompatibleUnits : public OperationError {
138
140
protected:
139
- const Number& lhs;
140
- const Number& rhs;
141
+ // const Sass::UnitType lhs;
142
+ // const Sass::UnitType rhs;
141
143
public:
142
144
IncompatibleUnits (const Number& lhs, const Number& rhs);
145
+ IncompatibleUnits (const UnitType lhs, const UnitType rhs);
143
146
virtual ~IncompatibleUnits () throw () {};
144
147
};
145
148
Original file line number Diff line number Diff line change 1
1
#include " sass.hpp"
2
2
#include < stdexcept>
3
3
#include " units.hpp"
4
+ #include " error_handling.hpp"
4
5
5
6
namespace Sass {
6
7
@@ -177,7 +178,7 @@ namespace Sass {
177
178
size_t i2 = u2 - t2;
178
179
// error if units are not of the same group
179
180
// don't error for multiplication and division
180
- if (strict && t1 != t2) throw incompatibleUnits (u1, u2);
181
+ if (strict && t1 != t2) throw Exception::IncompatibleUnits (u1, u2);
181
182
// only process known units
182
183
if (u1 != UNKNOWN && u2 != UNKNOWN) {
183
184
switch (t1) {
Original file line number Diff line number Diff line change @@ -66,27 +66,6 @@ namespace Sass {
66
66
// throws incompatibleUnits exceptions
67
67
double conversion_factor (const std::string&, const std::string&, bool = true );
68
68
69
- class incompatibleUnits : public std ::exception
70
- {
71
- public:
72
- const char * msg;
73
- incompatibleUnits (Sass::UnitType a, Sass::UnitType b)
74
- : exception()
75
- {
76
- std::stringstream ss;
77
- ss << " Incompatible units: " ;
78
- ss << " '" << unit_to_string (a) << " ' and " ;
79
- ss << " '" << unit_to_string (b) << " '" ;
80
- // hold on to string on stack!
81
- std::string str (ss.str ());
82
- msg = str.c_str ();
83
- }
84
- virtual const char * what () const throw()
85
- {
86
- return msg;
87
- }
88
- };
89
-
90
69
}
91
70
92
71
#endif
You can’t perform that action at this time.
0 commit comments