From 9224a8792b79f94f4680c4444de72b9b905b5bf0 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Fri, 17 May 2024 13:34:56 -0600 Subject: [PATCH] log before debugger, https://github.com/phetsims/aqua/issues/212 Signed-off-by: Michael Kauzmann --- js/assert.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/assert.js b/js/assert.js index 9bd7be8..58f5493 100644 --- a/js/assert.js +++ b/js/assert.js @@ -22,6 +22,10 @@ // Add "Assertion Failed" to the front of the message list const assertPrefix = messages.length > 0 ? 'Assertion failed: ' : 'Assertion failed'; console && console.error && console.error( assertPrefix, ...messages ); + + // eslint-disable-next-line bad-phet-library-text + window.phet?.joist?.sim && console.log( 'Debug info:', JSON.stringify( window.phet.joist.sim.getAssertionDebugInfo(), null, 2 ) ); + if ( window.QueryStringMachine && QueryStringMachine.containsKey( 'debugger' ) ) { debugger; // eslint-disable-line no-debugger } @@ -36,9 +40,6 @@ Error.stackTraceLimit = 20; } - // eslint-disable-next-line bad-phet-library-text - window.phet?.joist?.sim && console.log( 'Debug info:', JSON.stringify( window.phet.joist.sim.getAssertionDebugInfo(), null, 2 ) ); - throw new Error( assertPrefix + messages.join( '\n ' ) ); } };