Better error messages

Use the error message passed by the error exception instead of
always reporting "Error rendering image".
This commit is contained in:
Thiago Marcos P. Santos
2015-06-16 16:42:33 +03:00
committed by Mike Morris
parent 27fc2f18e3
commit d434746a46

View File

@@ -229,13 +229,22 @@ void NodeMap::renderFinished() {
assert(!image);
if (error) {
std::string errorMessage;
try {
std::rethrow_exception(error);
} catch (const std::exception& ex) {
errorMessage = ex.what();
}
v8::Local<v8::Value> argv[] = {
NanError(errorMessage.c_str())
};
// This must be empty to be prepared for the next render call.
error = nullptr;
assert(!error);
v8::Local<v8::Value> argv[] = {
NanError("Error rendering image")
};
cb->Call(1, argv);
} else if (img) {
auto result = NanNew<v8::Object>();