mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Rescue JSON::ParserError where already converted (#38244)
This commit is contained in:
@@ -88,7 +88,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||
value: version,
|
||||
human_value: version,
|
||||
}
|
||||
rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError
|
||||
rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, JSON::ParserError
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +78,7 @@ class TranslationService::DeepL < TranslationService
|
||||
provider: 'DeepL.com'
|
||||
)
|
||||
end
|
||||
rescue Oj::ParseError
|
||||
rescue JSON::ParserError
|
||||
raise UnexpectedResponseError
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ class TranslationService::LibreTranslate < TranslationService
|
||||
provider: 'LibreTranslate'
|
||||
)
|
||||
end
|
||||
rescue Oj::ParseError
|
||||
rescue JSON::ParserError
|
||||
raise UnexpectedResponseError
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class VideoMetadataExtractor
|
||||
@metadata = JSON.parse(ffmpeg_command_output, symbolize_names: true)
|
||||
|
||||
parse_metadata
|
||||
rescue Terrapin::ExitStatusError, Oj::ParseError
|
||||
rescue Terrapin::ExitStatusError, JSON::ParserError
|
||||
@invalid = true
|
||||
rescue Terrapin::CommandNotFoundError
|
||||
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffprobe` command. Please install ffmpeg.' # rubocop:disable I18n/RailsI18n/DecorateString -- This error is not user-facing
|
||||
|
||||
@@ -57,7 +57,7 @@ class Webfinger
|
||||
|
||||
def perform
|
||||
Response.new(@uri, body_from_webfinger)
|
||||
rescue Oj::ParseError
|
||||
rescue JSON::ParserError
|
||||
raise Webfinger::Error, "Invalid JSON in response for #{@uri}"
|
||||
rescue Addressable::URI::InvalidURIError
|
||||
raise Webfinger::Error, "Invalid URI for #{@uri}"
|
||||
|
||||
Reference in New Issue
Block a user