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

Side by Side Diff: test/mjsunit/es6/debug-promises-caught-uncaught.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: always use original exception 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 // Test debug events when we only listen to uncaught exceptions and
8 // there is a catch handler for the exception thrown in a Promise.
9 // Expectation:
10 // - no debug event is triggered.
11
12 Debug = debug.Debug;
13
14 var p = new Promise(function(resolve, reject) {
15 resolve();
16 });
17
18 var q = p.chain(
19 function() {
20 throw new Error("caught");
21 });
22
23 q.catch(
24 function(e) {
25 assertEquals("caught", e.message);
26 });
27
28 function listener(event, exec_state, event_data, data) {
29 try {
30 assertTrue(event != Debug.DebugEvent.Exception);
31 assertTrue(event != Debug.DebugEvent.PendingExceptionInPromise);
32 } catch (e) {
33 // Signal a failure with exit code 1. This is necessary since the
34 // debugger swallows exceptions and we expect the chained function
35 // and this listener to be executed after the main script is finished.
36 print("Unexpected exception: " + e + "\n" + e.stack);
37 quit(1);
38 }
39 }
40
41 Debug.setBreakOnUncaughtException();
42 Debug.setListener(listener);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698