luckyframework / lucky

A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.
https://luckyframework.org
MIT License
2.57k stars 156 forks source link

Improve the error output when newbie user forget settings LUCKY_ENV to production. #1868

Closed zw963 closed 2 weeks ago

zw963 commented 2 months ago

Describe the bug

When user build a static binary, then copy file into server for deploy, if user no correct setting LUCKY_ENV to production, will get error message like following:

Unhandled exception: Expected config file for the watcher at ./config/watch.yml (Exception)

Which raised from line 20 of config/server.cr. (please check following screenshot)

image

Expected behavior I consider the better way is, to told user, if forget settings the correct LUCKY_ENV to production?

From the perspective of a new user (it's been a long time since I used Lucky), this is much more useful.

Screenshots/code

root@test1:~/college# bin/college
Unhandled exception: Expected config file for the watcher at ./config/watch.yml (Exception)
  from college/lib/lucky/src/lucky/server_settings.cr:43:7 in 'yaml_settings_file'
  from college/lib/lucky/src/lucky/server_settings.cr:33:33 in 'settings'
  from college/lib/lucky/src/lucky/server_settings.cr:11:25 in 'host'
  from college/config/server.cr:20:21 in '__crystal_main'
  from /home/zw963/Crystal/share/crystal/src/crystal/main.cr:129:5 in 'main_user_code'
  from /home/zw963/Crystal/share/crystal/src/crystal/main.cr:115:7 in 'main'
  from /home/zw963/Crystal/share/crystal/src/crystal/main.cr:141:3 in 'main'

Versions (please complete the following information):

Thank you.