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

Improve missing template error message #185

Open
jdkaplan opened this issue Jul 6, 2024 · 0 comments
Open

Improve missing template error message #185

jdkaplan opened this issue Jul 6, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@jdkaplan
Copy link
Owner

jdkaplan commented Jul 6, 2024

The CLI will error when trying to use a migration template file that doesn't exist. An example of the current error message:

$ squill new --template missing --name this
Error: failed to render template: Template 'missing/new.up.sql' not found

This message comes almost directly from Tera. A better error message would include Squill-specific information:

  • The full (relative?) path of the missing template(s)
  • A special message if the template subdirectory (or the whole templates_dir) doesn't exist
  • A special message if the templates_dir is unconfigured/default

A sketch of something better:

Error: failed to render template: `.squill/templates/missing` not found
Error: failed to render template: `.squill/templates/missing/up.sql` not found
Error: failed to render template: `.squill/templates` (templates_dir) not found
Error: failed to render template: no templates_dir configured

Implementation notes

It may be easier to track which template files exist by tracking them in a map explicitly instead of using the one big tera::Tera instance.

Multi-template support was added in #168

@jdkaplan jdkaplan added the good first issue Good for newcomers label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant