Skip to content

Commit 3354f02

Browse files
Copilotjackfirth
andauthored
Log warnings instead of errors when analyzers fail (#732)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jackfirth <[email protected]>
1 parent c15eac2 commit 3354f02

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

private/analysis.rkt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
source-name)
115115
(cond
116116
[(unbox error-box)
117-
(log-resyntax-error
117+
(log-resyntax-warning
118118
"analyzer ~a failed with error while analyzing ~a: ~a"
119119
(object-name analyzer)
120120
source-name
@@ -413,4 +413,21 @@
413413
(check-true (syntax-property-bundle? props))
414414
(define root-props (syntax-property-bundle-get-immediate-properties props empty-syntax-path))
415415
;; The fast-prop should be present since the analyzer completed successfully
416-
(check-equal? (hash-ref root-props 'fast-prop #false) #true)))
416+
(check-equal? (hash-ref root-props 'fast-prop #false) #true))
417+
418+
(test-case "failing analyzer is skipped and warning is logged"
419+
;; Create a test analyzer that raises an error
420+
(define test-source (string-source "#lang racket/base (define x 1)"))
421+
422+
(define failing-analyzer
423+
(make-expansion-analyzer
424+
#:name 'failing-analyzer
425+
(λ (expanded)
426+
;; This will raise an error
427+
(error "intentional test error"))))
428+
429+
;; Run analysis with the failing analyzer - should skip it and not crash
430+
(define analysis (source-analyze test-source #:analyzers (list failing-analyzer)))
431+
432+
;; Check that the analysis completed (even though the analyzer failed)
433+
(check-true (source-code-analysis? analysis))))

0 commit comments

Comments
 (0)