Skip to content

Commit 5c14d51

Browse files
author
Alan Boudreault
committed
Fix error report when we call a function
1 parent c465f6c commit 5c14d51

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: mapv8.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ void msV8FreeContext(mapObj *map)
286286
* style. */
287287
char* msV8GetFeatureStyle(mapObj *map, const char *filename, layerObj *layer, shapeObj *shape)
288288
{
289+
TryCatch try_catch;
289290
V8Context* v8context = V8CONTEXT(map);
290291
char *ret = NULL;
291292

@@ -317,6 +318,10 @@ char* msV8GetFeatureStyle(mapObj *map, const char *filename, layerObj *layer, sh
317318
}
318319
Handle<Function> func = Handle<Function>::Cast(value);
319320
Handle<Value> result = func->Call(global, 0, 0);
321+
if (result.IsEmpty() && try_catch.HasCaught()) {
322+
msV8ReportException(&try_catch);
323+
}
324+
320325
if (!result.IsEmpty() && !result->IsUndefined()) {
321326
String::AsciiValue ascii(result);
322327
ret = msStrdup(*ascii);
@@ -328,6 +333,7 @@ char* msV8GetFeatureStyle(mapObj *map, const char *filename, layerObj *layer, sh
328333
/* for geomtransform, we don't have the mapObj */
329334
shapeObj *msV8TransformShape(shapeObj *shape, const char* filename)
330335
{
336+
TryCatch try_catch;
331337
Isolate *isolate = Isolate::GetCurrent();
332338
V8Context *v8context = (V8Context*)isolate->GetData();
333339

@@ -353,6 +359,10 @@ shapeObj *msV8TransformShape(shapeObj *shape, const char* filename)
353359
}
354360
Handle<Function> func = Handle<Function>::Cast(value);
355361
Handle<Value> result = func->Call(global, 0, 0);
362+
if (result.IsEmpty() && try_catch.HasCaught()) {
363+
msV8ReportException(&try_catch);
364+
}
365+
356366
if (!result.IsEmpty() && result->IsObject()) {
357367
Handle<Object> obj = result->ToObject();
358368
if (obj->GetConstructorName()->Equals(String::New("shapeObj"))) {

0 commit comments

Comments
 (0)