Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error location when several files in scope. #262

Open
CryptoPascal31 opened this issue Oct 15, 2024 · 1 comment · May be fixed by #284
Open

Wrong error location when several files in scope. #262

CryptoPascal31 opened this issue Oct 15, 2024 · 1 comment · May be fixed by #284

Comments

@CryptoPascal31
Copy link

Issue description

When a "sub-REPL file" triggers an error, pact mistakenly locates the error in the main REPL file.

Steps to reproduce

Let's see an example

File nested-script.repl:

; 10 empty lines
;
;
;
;
;
;
;
;
;
(defun just-fail:bool ()
  (enforce false "We fail")
)

File main-script.repl:

(load "nested-script.repl")
; Call just-fail
(just-fail)
;
;
;
;
;
;
;
;
; Hello

Now let's run main-script

$ pact-5
pact>(load "main-script.repl")
"Loading main-script.repl..."
"Loading nested-script.repl..."
Loaded repl defun just-fail
main-script.repl:12:2: We fail
 12 | ; Hello
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^
  at (#repl.just-fail)

pact>

As expected, the "enforce" of line 12 of nested-script.repl trigger a failure... But pact locates the error in the wrong file: line 12 of main-script.repl, and shows the wrong line content: here "Hello" instead of (enforce false "We fail")

Expected Behavior

I would expect Pact to locate the error in nested-script.repl

@jmcardon
Copy link
Member

@CryptoPascal31 thanks for the report.

We're actually aware of this one.

The line locations aren't reported incorrectly actually, it's rather that the error message is pointing to the wrong source file.

We will fix this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants