Skip to content

Better error messages (include filename) #13

@cgay

Description

@cgay

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?}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions