Sha256: 985c3be41f601ee847610d27e4d029807246a2b4d6ffb55bbbf5b0f9994870fc

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true

module Hbtrack
  class ErrorHandler
    class << self
      def raise_error_msg(msg)
        Util.red msg
      end

      def raise_if_habit_error(habit_name)
        return raise_invalid_arguments if habit_name.nil?
        raise_habit_not_found(habit_name)
      end

      def raise_habit_not_found(habit_name)
        raise_error_msg "Invalid habit: #{habit_name} not found."
      end

      def raise_invalid_arguments
        raise_error_msg 'Invalid argument: habit_name is expected.'
      end

      def raise_habit_name_too_long
        raise_error_msg 'habit_name too long.'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hbtrack-0.0.8 lib/hbtrack/error_handler.rb
hbtrack-0.0.7 lib/hbtrack/error_handler.rb
hbtrack-0.0.6 lib/hbtrack/error_handler.rb