Skip to content

Improve missing template error message #185

Open

Description

@jdkaplan

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions