Commit 4a6a9cc6 by Marcin Cieslak

Introduce SassValueWrapper::fail()

This method uses Sass error value
as a vehicle to report the error message,
but returns NULL to indicate constructor
failure.

This is used to tell successful creation
of the Sass error object from the constructor
failure, where no valid Sass object can be
created.
parent 74403d17
...@@ -25,6 +25,7 @@ namespace SassTypes ...@@ -25,6 +25,7 @@ namespace SassTypes
static v8::Local<v8::Function> get_constructor(); static v8::Local<v8::Function> get_constructor();
static v8::Local<v8::FunctionTemplate> get_constructor_template(); static v8::Local<v8::FunctionTemplate> get_constructor_template();
static NAN_METHOD(New); static NAN_METHOD(New);
static Sass_Value *fail(const char *, Sass_Value **);
protected: protected:
Sass_Value* value; Sass_Value* value;
...@@ -119,6 +120,12 @@ namespace SassTypes ...@@ -119,6 +120,12 @@ namespace SassTypes
T* SassValueWrapper<T>::unwrap(v8::Local<v8::Object> obj) { T* SassValueWrapper<T>::unwrap(v8::Local<v8::Object> obj) {
return static_cast<T*>(Factory::unwrap(obj)); return static_cast<T*>(Factory::unwrap(obj));
} }
template <class T>
Sass_Value *SassValueWrapper<T>::fail(const char *reason, Sass_Value **out) {
*out = sass_make_error(reason);
return NULL;
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment