Class: X::MissingMediaData
- Inherits:
-
Uploads::Error
- Object
- Error
- Uploads::Error
- X::MissingMediaData
- Defined in:
- x-uploads/lib/x/uploads/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. So does one whose media is not what the API documents, such as an identifier that is not one, or processing information of another type, as a gateway in front of the API might answer with, rather than fail as it is read. 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::Uploads::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".
40 41 42 43 44 45 |
# File 'x-uploads/lib/x/uploads/missing_media_data.rb', line 40 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
25 26 27 |
# File 'x-uploads/lib/x/uploads/missing_media_data.rb', line 25 def problems @problems end |