Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: test/mjsunit/es6/debug-promises-caught.js

Issue 249503002: Trigger debug event on not yet caught exception in promises. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-promises --expose-debug-as debug
6
7 Debug = debug.Debug;
8
9 var resolve_fun;
10 var log = [];
11
12 var p = new Promise(function(resolve, reject) {
13 log.push("resolve");
14 resolve();
15 });
16
17 var q = p.chain(
18 function() {
19 log.push("throw");
20 throw new Error("caught");
21 });
22
23 q.catch(function(e) {
24 assertEquals("caught", e.message);
25 });
26
27 function listener(event, exec_state, event_data, data) {
28 try {
29 assertEquals(["resolve", "end main", "throw"], log);
yurys 2014/04/24 07:48:43 Just curious: I'd expect "end main" to be logged b
Yang 2014/04/24 07:59:59 Yes. The function in line 12 is executed immediate
30 assertTrue(event != Debug.DebugEvent.PendingExceptionInPromise);
31 if (event == Debug.DebugEvent.Exception) {
32 assertEquals("caught", event_data.exception().message);
33 assertEquals(undefined, event_data.deferred_promise());
34 }
35 } catch (e) {
36 // Signal a failure with exit code 1. This is necessary since the
37 // debugger swallows exceptions and we expect the chained function
38 // and this listener to be executed after the main script is finished.
39 print(e + "\n" + e.stack);
rossberg 2014/04/24 07:27:36 Maybe add "Unexpected exception: ".
40 quit(1);
41 }
42 }
43
44 Debug.setBreakOnException();
45 Debug.setListener(listener);
46
47 log.push("end main");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698