Sha256: 9fbf6bd0cf1a754aa3bb5760f9fcfc4c34a8abf2568578b5c5387c09b8a15473
Contents?: true
Size: 1.94 KB
Versions: 10
Compression:
Stored size: 1.94 KB
Contents
module Fontist module Errors class GeneralError < StandardError; end class BinaryCallError < GeneralError; end class FontIndexCorrupted < GeneralError; end class FontNotFoundError < GeneralError; end class FormulaIndexNotFoundError < GeneralError; end class InvalidResourceError < GeneralError; end class LicensingError < GeneralError; end class ManifestCouldNotBeFoundError < GeneralError; end class ManifestCouldNotBeReadError < GeneralError; end class MissingAttributeError < GeneralError; end class TamperedFileError < GeneralError; end class TimeoutError < GeneralError; end class UnknownFontTypeError < GeneralError; end class UnknownArchiveError < GeneralError; end class FontError < GeneralError attr_reader :font, :style def initialize(msg, font = nil, style = nil) @font = font @style = style super(msg) end def name messages = [] messages << "Font name: '#{@font}'" messages << "Style: '#{@style}'" if @style messages.join("; ") end end class MissingFontError < FontError def initialize(font, style = nil) name = prepare_name(font, style) msg = "#{name} font is missing, please run `fontist install '#{font}'` to download the font." super(msg, font, style) end private def prepare_name(font, style) names = [] names << "'#{font}'" names << "'#{style}'" if style names.join(" ") end end class UnsupportedFontError < FontError def initialize(font) msg = <<~MSG.chomp Font '#{font}' not found locally nor available in the Fontist formula repository. Perhaps it is available at the latest Fontist formula repository. You can update the formula repository using the command `fontist update` and try again. MSG super(msg, font) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems