Exception: Chatwerk::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/chatwerk/error.rb

Direct Known Subclasses

NotFoundError

Instance Method Summary collapse

Constructor Details

#initialize(error, package_path: nil, **args) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/chatwerk/error.rb', line 5

def initialize(error, package_path: nil, **args)
  message =
    if package_path && !package_path.empty?
      "There was a problem finding or accessing #{package_path.inspect}"
    else
      'There was a problem accessing package information'
    end

  super(<<~ERROR)
    #{message}
    Error: #{error}

    * Please ensure that the package path is correct.
    * Check that there is a package.yml file in the given directory.
    * Check that the path is a project root relative path that doesn't start with a slash.
    * Try calling the packages tool with the package_path to see if it is valid.
  ERROR
end