Class: MIDB::Interface::Errors
- Inherits:
-
Object
- Object
- MIDB::Interface::Errors
- Defined in:
- lib/midb/errors_view.rb
Overview
A view that outputs errors.
Class Method Summary collapse
-
.die(err) ⇒ Object
Handles fatal errors that will cause the application to abrort.
Class Method Details
.die(err) ⇒ Object
Handles fatal errors that will cause the application to abrort.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/midb/errors_view.rb', line 8 def self.die(err) errmsg = case err when :noargs then "No command supplied. See `midb help`." when :server_already_started then "The server has already been started and is running." when :server_not_running then "The server isn't running." when :server_error then "Error while starting server." when :no_serves then "No files are being served. Try running `midb serve file.json`" when :syntax then "Syntax error. See `midb help`" when :file_404 then "File not found." when :not_json then "Specified file isn't JSON!" when :json_exists then "Specified file is already being served." when :json_not_exists then "The JSON file isn't being served." when :unsupported_engine then "The specified database engine isn't supported by midb." when :already_project then "This directory already contains a midb project." when :bootstrap then "midb hasn't been bootstraped in this folder. Run `midb bootstrap`." when :no_help then "No help available for this command. See a list of commands with `midb help`." else "Unknown error: #{err.to_s}" end abort("Fatal error: #{errmsg}") end |