Sha256: f42053fee91924f3814ead2b3680d421e69697c49abd7eb053d294d9ecb80f2a
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
module Npmdc module Errors class Error < StandardError attr_reader :options def initialize(msg = nil, **options) @options = options super(msg) end def banner raise(NotImplementedError, '#banner has to be implemented in subclass') end end class CheckerError < Error; end class ConfigurationError < Error; end class NoNodeModulesError < CheckerError def banner path = options.fetch(:path) [ "Can't find `node_modules` folder inside '#{path}' directory!", ["\nRun `npm install` to install missing packages.", :warn] ] end end class WrongPathError < CheckerError def banner directory = options.fetch(:directory) "There is no '#{directory}' directory." end end class MissedPackageError < CheckerError def banner directory = options.fetch(:directory) "There is no `package.json` file inside '#{directory}' directory." end end class JsonParseError < CheckerError def banner path = options.fetch(:path) "Can't parse JSON file #{path}" end end class UnknownFormatter < ConfigurationError def banner formatter = options.fetch(:formatter) "Unknown '#{formatter}' formatter" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
npmdc-0.3.2 | lib/npmdc/errors.rb |
npmdc-0.3.1 | lib/npmdc/errors.rb |
npmdc-0.3.0 | lib/npmdc/errors.rb |