livebud / bud

The Full-Stack Web Framework for Go
MIT License
5.53k stars 182 forks source link

misc: improve errors. generate: catch missing module errors and attempt to download them #376

Closed matthewmueller closed 1 year ago

matthewmueller commented 1 year ago

I've been staring at errors so long, I forgot how confusing they can be. This PR reverses the stack, so you get the cause first, which should be more specific than the final error.

Before:

CleanShot 2023-02-06 at 02 06 56@2x

After:

CleanShot 2023-02-06 at 02 04 20@2x

This PR also detects module not found errors and tries to download them during bud generate. This should hopefully eliminate some errors around the runtime not being present.

I quite like this solution because it only attempts to download them upon error, so it doesn't slow down the common path.