Sha256: bce5a2d975b137676dee54c5c729a27e210e880ce83302569675f00027a36db1

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

require_relative '../output/logger'

require_relative './cause'

require_relative './case/pattern'

require_relative './zakuro_error'

# :nodoc:
module Zakuro
  # :nodoc:
  module Exception
    # @return [Output::Logger] ロガー
    LOGGER = Output::Logger.new(location: 'exception')

    # @return [String] 共通メッセージ
    MESSAGE = 'an error has occurred'

    #
    # 例外を取得する
    #
    # @param [Array<Template>] presets 原因プリセット
    #
    # @return [ZakuroError] ライブラリエラー
    #
    def self.get(presets: [])
      causes = []
      presets.each do |preset|
        causes.push(Cause.new(code: preset.code, message: preset.message))
      end

      ZakuroError.new(msg: MESSAGE, causes: causes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zakuro-0.7.0 lib/zakuro/exception/exception.rb