File: errors.rb

package info (click to toggle)
ruby-oembed 0.10.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,440 kB
  • ctags: 190
  • sloc: ruby: 2,325; makefile: 3
file content (47 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module OEmbed
  
  # A generic OEmbed-related Error. The OEmbed library does its best to capture all internal
  # errors and wrap them in an OEmbed::Error class so that the error-handling code in your
  # application can more easily identify the source of errors.
  #
  # The following Classes inherit from OEmbed::Error
  # * OEmbed::FormatNotSupported
  # * OEmbed::NotFound
  # * OEmbed::ParseError
  # * OEmbed::UnknownFormat
  # * OEmbed::UnknownResponse
  class Error < StandardError
  end

  # This is a test
  class NotFound < OEmbed::Error # :nodoc:
    def to_s
      "No embeddable content at '#{super}'"
    end
  end

  class UnknownFormat < OEmbed::Error # :nodoc:
    def to_s
      "The provider doesn't support the '#{super}' format"
    end
  end

  class FormatNotSupported < OEmbed::Error # :nodoc:
    def to_s
      "This server doesn't have the correct libraries installed to support the '#{super}' format"
    end
  end

  class UnknownResponse < OEmbed::Error # :nodoc:
    def to_s
      "Got unknown response (#{super}) from server"
    end
  end

  class ParseError < OEmbed::Error # :nodoc:
    def to_s
      "There was an error parsing the server response (#{super})"
    end
  end
    
end