Exception: ZipContainer::MalformedContainerError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- ZipContainer::MalformedContainerError
- Includes:
- Error
- Defined in:
- lib/zip-container/exceptions.rb
Overview
This exception is raised when a bad Container is detected.
Instance Method Summary collapse
-
#initialize(reason = nil) ⇒ MalformedContainerError
constructor
:call-seq: new new(reason) new(reason_list).
Constructor Details
#initialize(reason = nil) ⇒ MalformedContainerError
:call-seq:
new
new(reason)
new(reason_list)
Create a new MalformedContainerError with an optional reason or list of reasons for why the Container is malformed.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/zip-container/exceptions.rb', line 56 def initialize(reason = nil) if reason.nil? || reason.empty? super('Malformed Container.') elsif reason.is_a?(Array) reasons = reason.map { |r| " * #{r}\n" } super("Malformed Container:\n#{reasons}") else super("Malformed Container: #{reason}") end end |