1
1
#include < glib.h>
2
2
#include < nan.h>
3
3
4
+ #include " closure.h"
4
5
#include " debug.h"
5
- #include " function .h"
6
+ #include " loop .h"
6
7
#include " type.h"
7
8
#include " value.h"
8
9
9
10
using namespace v8 ;
10
11
11
12
namespace GNodeJS {
12
13
13
- struct Closure {
14
- GClosure base;
15
- Persistent<Function> persistent;
16
- GISignalInfo* info;
17
-
18
- ~Closure () {
19
- if (info)
20
- g_base_info_unref (info);
21
- }
22
-
23
- static void Marshal (GClosure *closure,
24
- GValue *g_return_value,
25
- uint argc, const GValue *g_argv,
26
- gpointer invocation_hint,
27
- gpointer marshal_data);
28
-
29
- static void Invalidated (gpointer data, GClosure *closure);
30
- };
31
-
32
14
void Closure::Marshal (GClosure *base,
33
15
GValue *g_return_value,
34
16
uint argc, const GValue *g_argv,
@@ -78,12 +60,11 @@ void Closure::Marshal(GClosure *base,
78
60
}
79
61
}
80
62
else {
81
- auto stackTrace = try_catch.StackTrace ();
82
- if (!stackTrace.IsEmpty ())
83
- printf (" %s\n " , *Nan::Utf8String (stackTrace.ToLocalChecked ()));
84
- else
85
- printf (" %s\n " , *Nan::Utf8String (try_catch.Exception ()));
86
- exit (1 );
63
+ log (" '%s' did throw" , g_base_info_get_name (closure->info ));
64
+
65
+ GNodeJS::QuitLoopStack ();
66
+
67
+ try_catch.ReThrow ();
87
68
}
88
69
89
70
#ifndef __linux__
@@ -96,7 +77,7 @@ void Closure::Invalidated(gpointer data, GClosure *base) {
96
77
closure->~Closure ();
97
78
}
98
79
99
- GClosure *MakeClosure (Isolate *isolate, Local<Function> function, GISignalInfo * info) {
80
+ GClosure *MakeClosure (Isolate *isolate, Local<Function> function, GIBaseInfo * info) {
100
81
Closure *closure = (Closure *) g_closure_new_simple (sizeof (*closure), NULL );
101
82
closure->persistent .Reset (isolate, function);
102
83
closure->info = info;
0 commit comments