# This file defines all possible exceptions that can be thrown by # GeneValidatorApp on startup. # # Exceptions only ever inform another entity (downstream code or users) of an # issue. Exceptions may or may not be recoverable. # # Error classes should be seen as: the error code (class name), human readable # message (to_s method), and necessary attributes to act on the error. # # We define as many error classes as needed to be precise about the issue, thus # making it easy for downstream code (bin/genevalidatorapp or config.ru) to act # on them. module GeneValidatorApp # Error in config file. class CONFIG_FILE_ERROR < StandardError def initialize(ent, err) @ent = ent @err = err end attr_reader :ent, :err def to_s < at , but # didn't". # # ENOENT is raised if and only if an entity was set, either using CLI or # config file. For instance, it's compulsory to set database_dir. But ENOENT # is not raised if database_dir is not set. ENOENT is raised if database_dir # was set, but does not exist. class ENOENT < StandardError def initialize(des, ent) @des = des @ent = ent end attr_reader :des, :ent def to_s "Could not find #{des}: #{ent}" end end # Raised if bin dir set, but does not exist. class BIN_DIR_NOT_FOUND < ENOENT def initialize(ent) super 'bin dir', ent end end # Raised if database dir set, but does not exist. class DATABASE_DIR_NOT_FOUND < ENOENT def initialize(ent) super 'database dir', ent end end # Raised if extension file set, but does not exist. class EXTENSION_FILE_NOT_FOUND < ENOENT def initialize(ent) super 'extension file', ent end end ## NUM THREADS ## # Raised if num_threads set by the user is incorrect. class NUM_THREADS_INCORRECT < StandardError def to_s 'Number of threads should be a number greater than or equal to 1.' end end ## BLAST NOT INSTALLED OR NOT COMPATIBLE ## # Raised if SequenceServer could not locate NCBI BLAST+ installation on # user's system. class BLAST_NOT_INSTALLED < StandardError def to_s 'Could not locate BLAST+ binaries.' end end # Raised if SequenceServer could not successfully execute 'blastp -version' # on user's system (see #141). class BLAST_NOT_EXECUTABLE < StandardError def to_s 'Error executing BLAST+ binaries.' end end # Raised if SequenceServer determined NCBI BLAST+ present on the user's # system but not meeting SequenceServer's minimum version requirement. class BLAST_NOT_COMPATIBLE < StandardError def initialize(version) @version = version end attr_reader :version def to_s <