Class: X::MissingMediaData
- Inherits:
-
Uploader::Error
- Object
- Error
- Uploader::Error
- X::MissingMediaData
- Defined in:
- x-uploader/lib/x/uploader/missing_media_data.rb
Overview
Raised when a response of an upload holds none of the data it describes the media with
The API answers an upload, a status check, and a change of metadata with what it acted on, under the data of the response. A response that succeeded without it holds nothing an upload can go on, so the uploaders raise this rather than fail later on what is missing. A response that holds problems in place of the data, as one for media X does not know of does, names the reason in them, which the error holds, and names in its message.
It descends from X::Uploader::Error, and so from X::Error, so rescuing the failures of an upload catches it.
Instance Attribute Summary collapse
-
#problems ⇒ Array<Problem>
readonly
The problems the response reported in place of the data.
Instance Method Summary collapse
-
#initialize(message = nil, problems: []) ⇒ MissingMediaData
constructor
Initialize the error with the reason X gave for holding no data.
Constructor Details
#initialize(message = nil, problems: []) ⇒ MissingMediaData
Initialize the error with the reason X gave for holding no data
The message is the one given, then the detail, or else the message or the title, of the first problem the response reported, as "The response of the status check holds no media: Could not find media".
38 39 40 41 42 43 |
# File 'x-uploader/lib/x/uploader/missing_media_data.rb', line 38 def initialize( = nil, problems: []) @problems = problems.dup.freeze reason = problems.first&.then { |problem| problem.detail || problem. || problem.title } parts = [, reason].compact super((parts.join(": ") unless parts.empty?)) end |
Instance Attribute Details
#problems ⇒ Array<Problem> (readonly)
The problems the response reported in place of the data
23 24 25 |
# File 'x-uploader/lib/x/uploader/missing_media_data.rb', line 23 def problems @problems end |