Skip to content

Commit

Permalink
Add helpful debug information before the assertion Error is thrown, see
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed May 16, 2024
1 parent f2cbaf1 commit f2dec35
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/Sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import ArrayIO from '../../tandem/js/types/ArrayIO.js';
import { Locale } from './i18n/localeProperty.js';
import isSettingPhetioStateProperty from '../../tandem/js/isSettingPhetioStateProperty.js';
import StringIO from '../../tandem/js/types/StringIO.js';
import dotRandom from '../../dot/js/dotRandom.js';

// constants
const PROGRESS_BAR_WIDTH = 273;
Expand Down Expand Up @@ -1102,6 +1103,16 @@ export default class Sim extends PhetioObject {
} );
}
}

/**
* Get helpful information for replicating the bug when an assertion occurs.
*/
public getAssertionDebugInfo(): object {
return {
seed: dotRandom.getSeed(),
currentScreenName: this.selectedScreenProperty?.value?.constructor.name
};
}
}

type LayoutNode = Node & {
Expand Down

0 comments on commit f2dec35

Please sign in to comment.