janet-lang / jpm

Janet Project Manager
MIT License
68 stars 22 forks source link

error handling during load-lockfile #16

Closed subsetpark closed 2 years ago

subsetpark commented 2 years ago

I'm encountering the following error when trying to call load-lockfile in a build:

sudo jpm --config-file=builds.sr.ht/config.janet load-lockfile
error: bad slot #1, expected string|symbol|keyword|buffer, got nil
  in string/find [src/core/string.c] on line 309
  in resolve-bundle-name [/usr/lib/janet/jpm/pm.janet] on line 88, column 11
  in resolve-bundle [/usr/lib/janet/jpm/pm.janet] on line 120, column 10
  in bundle-install [/usr/lib/janet/jpm/pm.janet] on line 178, column 4
  in load-lockfile [/usr/lib/janet/jpm/pm.janet] (tailcall) on line 245, column 5
  in _thunk [/usr/bin/jpm] on line -1, column -1
  in cli-main [boot.janet] on line 3618, column 39

I'm sure that it's because my config.janet is misconfigured, as the same command works fine on my machine.

However, the resulting error makes it difficult to tell what needs resolving. Perhaps we could program a little more defensively and surface an error message pointing to the problem?

bakpakin commented 2 years ago

Can you post the lockfile?

subsetpark commented 2 years ago

Sure: https://git.sr.ht/~subsetpark/bagatto/blob/master/lockfile.jdn

bakpakin commented 2 years ago

Should be addressed in latest master, ~273c1738e4425893638a8fd441e6b820365c7ed6~ 0b11100297edaf0c3d0c8fe0fed97e4bb597fb5a, verify and close @subsetpark

subsetpark commented 2 years ago

https://builds.sr.ht/~subsetpark/job/590269

load-lockfile works now! So my hypothesis was wrong, and this wasn't error handling, but an actual bug... which is now fixed :)