44
44
js_set $test_iarg test_iarg;
45
45
js_set $test_var test_var;
46
46
js_set $test_log test_log;
47
+ js_set $test_except test_except;
47
48
48
49
js_include test.js;
49
50
@@ -91,6 +92,10 @@ http {
91
92
return 200 $test_log;
92
93
}
93
94
95
+ location /req_except {
96
+ return 200 $test_except;
97
+ }
98
+
94
99
location /res_status {
95
100
js_content status;
96
101
}
@@ -114,6 +119,10 @@ http {
114
119
location /res_ihdr {
115
120
js_content ihdr;
116
121
}
122
+
123
+ location /res_except {
124
+ js_content content_except;
125
+ }
117
126
}
118
127
}
119
128
@@ -172,6 +181,11 @@ $t->write_file('test.js', <<EOF);
172
181
req.log("SEE-THIS");
173
182
}
174
183
184
+ function test_except(req, res) {
185
+ var fs = require('fs');
186
+ fs.readFileSync();
187
+ }
188
+
175
189
function status(req, res) {
176
190
res.status = 204;
177
191
if (res.status != 204)
@@ -240,9 +254,14 @@ $t->write_file('test.js', <<EOF);
240
254
res.send(s);
241
255
res.finish();
242
256
}
257
+
258
+ function content_except(req, res) {
259
+ JSON.parse({}.a.a);
260
+ }
261
+
243
262
EOF
244
263
245
- $t -> try_run(' no njs available' )-> plan(20 );
264
+ $t -> try_run(' no njs available' )-> plan(22 );
246
265
247
266
# ##############################################################################
248
267
@@ -269,6 +288,9 @@ like(http_get('/res_hdr?foo=123&bar=copy'), qr/Bar: 123/, 'res.headers get');
269
288
like(http_get(' /res_hdr?bar=empty' ), qr / Bar: \x0d / , ' res.headers empty' );
270
289
like(http_get(' /res_ihdr?a=12&b=34' ), qr / ^1234$ / m , ' res.headers iteration' );
271
290
291
+ http_get(' /req_except' );
292
+ http_get(' /res_except' );
293
+
272
294
TODO: {
273
295
local $TODO = ' zero size buf in writer' ;
274
296
@@ -281,6 +303,10 @@ $t->todo_alerts();
281
303
$t -> stop();
282
304
283
305
ok(index ($t -> read_file(' error.log' ), ' SEE-THIS' ) > 0, ' log js' );
306
+ ok(index ($t -> read_file(' error.log' ), ' at fs.readFileSync' ) > 0,
307
+ ' js_set backtrace' );
308
+ ok(index ($t -> read_file(' error.log' ), ' at JSON.parse' ) > 0,
309
+ ' js_content backtrace' );
284
310
285
311
# ##############################################################################
286
312
0 commit comments