alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
284 stars 49 forks source link

Error reporting of toml file does not specify the location of the error #1563

Open Joebeazelman opened 8 months ago

Joebeazelman commented 8 months ago

If there's an issue with Alire.toml, Alire doesn't report where the error occurs in the toml file.


error: Cannot continue without a workspace:
error:    Loading release from manifest: alire.toml:
error:    Failed to load alire.toml:
error:    dependency version must be a string

APPLICATION alr version: 2.0-beta1 libalire version: 2.0-beta1 compilation date: 2023-10-19 15:15:43 compiled with version: 13.2.0

CONFIGURATION config folder: /Users/joebeazelman/.config/alire cache folder: /Users/joebeazelman/.cache/alire vault folder: /Users/joebeazelman/.cache/alire/releases build folder: /Users/joebeazelman/.cache/alire/builds force flag: FALSE non-interactive flag: FALSE community index branch: stable-1.2.1 compatible index versions: ^1.1 & <=1.2.1 indexes folder: /Users/joebeazelman/.config/alire/indexes indexes metadata: OK index #1: (community) git+https://github.com/alire-project/alire-index#stable-1.2.1 toolchain folder: /Users/joebeazelman/.cache/alire/toolchains toolchain assistant: disabled tool #1 gnat: gnat_avr_elf=13.2.1 tool #2 gprbuild: gprbuild=22.0.1

WORKSPACE root status: BROKEN root release: N/A root load error: Uninitialized Outcome root folder: N/A current folder: /Users/joebeazelman/Development/test_project

SYSTEM distribution: HOMEBREW host-arch: X86_64 os: MACOS target: NATIVE toolchain: USER word-size: BITS_64

Checklist

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Run '...'
  3. See error

Expected Behavior Describe what happened and how it deviates from what should have happened, if unclear from the previous steps.

alr version Paste here the output of alr version.

alr logs If pertinent, paste the output of alr -vv -d <your command> here.

mosteo commented 8 months ago

Our TOML parser doesn't associate source lines to the parsed data structure, so there's no easy solution for the short term. We do get source positions when the TOML syntax is wrong.

stcarrez commented 6 months ago

I made a PR on TOML for that https://github.com/pmderodat/ada-toml/issues/14

pmderodat commented 6 months ago

Hello! I’ve created a MR (https://github.com/pmderodat/ada-toml/pull/15) to preserve source location information in TOML values: before I merge it to the master branch and create a new ada-toml release, would you be okay to have a look and give me some feedback, to make sure what I did is useful? Thanks!