Skip to content

Commit

Permalink
WIP backtrace for errors outside expect
Browse files Browse the repository at this point in the history
  • Loading branch information
snogge committed Aug 22, 2024
1 parent d880439 commit 07b78c8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions buttercup.el
Original file line number Diff line number Diff line change
Expand Up @@ -2129,15 +2129,19 @@ ARGS according to `debugger'."
;; When the error occurs in the calling of one of the
;; wrapped expressions of an expect.
(buttercup--wrapper-fun-p (cadr frame))
;; TODO: When an error happens in code called outside an expect
;; When an error happens in code called outside an expect
;; buttercup--update-with-funcall
;; apply buttercup--funcall
;; buttercup--funcall - sets debugger
;; apply FUNCTION
;; FUNCTION -- spec body function
;; condition-case -- from buttercup-with-converted-ert-signals
;; progn -- the same
;; (let ((buttercup--stackframe-marker 1)) -- the same
;; ACTUAL CODE
(and (null (car frame))
(eq 'let (cadr frame))
(equal '((buttercup--stackframe-marker 1)) (caddr frame))
)
;; TODO: What about an error in a matcher?
;; TODO: What about :to-throw?
;; TODO: What about signals in before and after blocks?
Expand Down Expand Up @@ -2192,7 +2196,9 @@ Specifically, `ert-test-failed' is converted to
`buttercup-pending'."
(declare (indent 0))
`(condition-case err
(progn ,@body)
(let ((buttercup--stackframe-marker 1))
(ignore buttercup--stackframe-marker)
,@body)
(ert-test-failed
(buttercup-fail "%S" err))
(ert-test-skipped
Expand Down

0 comments on commit 07b78c8

Please sign in to comment.