Exception: OAI::Exception
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- OAI::Exception
- Defined in:
- lib/oai/exception.rb
Overview
Standard error responses for problems serving OAI content. These messages will be wrapped in an XML response to the client.
Direct Known Subclasses
ArgumentException, FormatException, IdException, MetadataFormatException, NoMatchException, ResumptionTokenException, SetException, VerbException
Constant Summary collapse
- CODE =
nil
- MESSAGE =
nil
- @@codes =
{}
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, code = nil) ⇒ Exception
constructor
A new instance of Exception.
Constructor Details
#initialize(message = nil, code = nil) ⇒ Exception
Returns a new instance of Exception.
22 23 24 25 |
# File 'lib/oai/exception.rb', line 22 def initialize( = nil, code = nil) super( || self.class::MESSAGE) @code = code || self.class::CODE end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
10 11 12 |
# File 'lib/oai/exception.rb', line 10 def code @code end |
Class Method Details
.for(message: nil, code: nil) ⇒ Object
18 19 20 |
# File 'lib/oai/exception.rb', line 18 def self.for(message: nil, code: nil) @@codes.fetch(code, Exception).new() end |