Skip to content

Potentially confusing error when view definition file doesn't exist #343

@derekprior

Description

@derekprior

I ran a scenic migration for a file that doesn't yet exist and was greeted with this:

== 20211216184824 CreateSearches: migrating ===================================
-- create_view(:searches)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

No such file or directory @ rb_sysopen - /Users/derek/src/scenic-views/blog/db/views/app_searches_v01.sql
/Users/derek/src/scenic-views/scenic/lib/scenic/definition.rb:10:in `read'
/Users/derek/src/scenic-views/scenic/lib/scenic/definition.rb:10:in `to_sql'
/Users/derek/src/scenic-views/scenic/lib/scenic/statements.rb:152:in `definition'
/Users/derek/src/scenic-views/scenic/lib/scenic/statements.rb:37:in `create_view'
/Users/derek/src/scenic-views/blog/db/migrate/20211216184824_create_searches.rb:3:in `change'

Caused by:
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/derek/src/scenic-views/blog/db/views/app_searches_v01.sql
/Users/derek/src/scenic-views/scenic/lib/scenic/definition.rb:10:in `read'
/Users/derek/src/scenic-views/scenic/lib/scenic/definition.rb:10:in `to_sql'
/Users/derek/src/scenic-views/scenic/lib/scenic/statements.rb:152:in `definition'
/Users/derek/src/scenic-views/scenic/lib/scenic/statements.rb:37:in `create_view'
/Users/derek/src/scenic-views/blog/db/migrate/20211216184824_create_searches.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

We should handle the no such file or directory error and offer something more helpful and less ugly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions