Sha256: 68d0344a3368796d7e56f82021322a611741b50e6522af5807683c1975044553

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

module FbErrorMachine

  class GraphApiError < ErrorBase

    attr_accessor :error_code, :description, :instructions

    def self.all
      @_errors ||= begin
        YAML.load_file(File.join(File.dirname(__FILE__), "graph_api_errors.yml")).map do |entry|
          GraphApiError.new(entry)
        end
      rescue Psych::SyntaxError, Errno::EACCES, Errno::ENOENT
        {}
      end
    end

    def self.find(error_code)
      GraphApiError.all.detect { |e| e.error_code == error_code.to_s }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_error_machine-0.1.1 lib/fb_error_machine/graph_api_error.rb