scenic icon indicating copy to clipboard operation
scenic copied to clipboard

Potentially confusing error when view definition file doesn't exist

Open derekprior opened this issue 3 years ago • 0 comments

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.

derekprior avatar Dec 16 '21 18:12 derekprior