@@ -43,13 +43,20 @@ export function clearFirstFinding(): Finding | undefined {
4343 * Save the first finding reported by any bug detector.
4444 *
4545 * @param findingMessage - The finding to be saved.
46+ * @param containStack - Whether the finding should contain a stack trace or not.
4647 */
47- export function reportFinding ( findingMessage : string ) : Finding | undefined {
48+ export function reportFinding (
49+ findingMessage : string ,
50+ containStack = true ,
51+ ) : Finding | undefined {
4852 // After saving the first finding, ignore all subsequent errors.
4953 if ( getFirstFinding ( ) ) {
5054 return ;
5155 }
5256 const reportedFinding = new Finding ( findingMessage ) ;
57+ if ( ! containStack ) {
58+ reportedFinding . stack = findingMessage ;
59+ }
5360 setJazzerJsGlobal ( firstFinding , reportedFinding ) ;
5461 return reportedFinding ;
5562}
@@ -59,9 +66,13 @@ export function reportFinding(findingMessage: string): Finding | undefined {
5966 * potentially abort the current execution.
6067 *
6168 * @param findingMessage - The finding to be saved and thrown.
69+ * @param containStack - Whether the finding should contain a stack trace or not.
6270 */
63- export function reportAndThrowFinding ( findingMessage : string ) : void | never {
64- throw reportFinding ( findingMessage ) ;
71+ export function reportAndThrowFinding (
72+ findingMessage : string ,
73+ containStack = true ,
74+ ) : void | never {
75+ throw reportFinding ( findingMessage , containStack ) ;
6576}
6677
6778/**
0 commit comments