Rescue JSON::ParserError where already converted (#38244)

This commit is contained in:
Matt Jankowski
2026-03-17 04:57:10 -04:00
committed by GitHub
parent f5619fc8bc
commit f07e84f9de
17 changed files with 75 additions and 11 deletions

View File

@@ -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

View File

@@ -78,7 +78,7 @@ class TranslationService::DeepL < TranslationService
provider: 'DeepL.com'
)
end
rescue Oj::ParseError
rescue JSON::ParserError
raise UnexpectedResponseError
end
end

View File

@@ -55,7 +55,7 @@ class TranslationService::LibreTranslate < TranslationService
provider: 'LibreTranslate'
)
end
rescue Oj::ParseError
rescue JSON::ParserError
raise UnexpectedResponseError
end
end

View File

@@ -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

View File

@@ -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}"