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

Better error messages (include filename) #13

Open
cgay opened this issue May 11, 2022 · 0 comments
Open

Better error messages (include filename) #13

cgay opened this issue May 11, 2022 · 0 comments
Labels

Comments

@cgay
Copy link
Member

cgay commented May 11, 2022

This is a terrible error message:

$ DYLAN_CATALOG=. ../_build/bin/pacman-catalog-test-suite --debug crashes
Running suite pacman-catalog-test-suite:
Running test test-validate-catalog:W 2022-05-11T04:31:50.000+0000 [Main thread] Using override catalog from $DYLAN_CATALOG: .

  validate-catalog(catalog()) doesn't signal an error : [Error evaluating assertion expression: @29:1 Unexpected data
}
^]
   FAILED in 0.032297s and 1MiB
Completed suite pacman-catalog-test-suite: FAILED in 0.032297s

Backtrace:
  invoke-debugger:internal:dylan##1 + 0x29
  default-handler:dylan:dylan##1 + 0x12
  default-last-handler:common-dylan-internals:common-dylan##0 + 0x2f6
  error:dylan:dylan##0 + 0x23
  0x7f5a241b8acc
  0x7f5a241b944a
  parse-any:%json:json##0 + 0x131
  parse-members:%json:json##0 + 0x9d
  parse-object:%json:json##0 + 0x74
  parse-json:json:json##0 + 0xc1
  load-catalog-package-file:%pacman:dylan-tool-commands + 0x2fb
  0x7f5a24427c8d
  %do-directory:system-internals:system + 0x136

Perhaps the obvious way to handle this is to add a method parse-json(source, <locator>) so that the locator could be included in the error message. But it would be nice to have a way to provide a context when parsing from string or stream as well, so maybe parse-json(source, #key ..., context :: false-or(<string>)) and it's up to the caller to provide the context.

\old_el_paso_girl{Why not both?}

@cgay cgay added the parser label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant