Skip to content

Commit

Permalink
Handle "This page is pending deletion" error page
Browse files Browse the repository at this point in the history
I've not seen this one before, but picked it up in testing today, so handle it as submission deleted
  • Loading branch information
Deer-Spangle committed Mar 11, 2024
1 parent 71364bf commit 32f1e00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/faexport/scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,8 @@ def check_errors(html, url)
end

# Handle "system message" type errors
maintable_head = html.at_css("table.maintable td.cat b")
if !maintable_head.nil? && maintable_head.content == "System Message"
maintable_head = p html.at_css("table.maintable td.cat")
if !maintable_head.nil? && (p maintable_head.content.strip) == "System Message"
maintable_content = html.at_css("table.maintable td.alt1").content
# Handle disabled accounts
if maintable_content.include?("has voluntarily disabled access to their account and all of its contents.")
Expand All @@ -1410,6 +1410,11 @@ def check_errors(html, url)
if maintable_content.include?("You are not allowed to view this image due to the content filter settings.")
raise FAContentFilterError.new(url)
end

# Handle page is pending deletion
if maintable_content.include?("The page you are trying to reach is currently pending deletion")
raise FANotFoundError.new(url)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/faexport/views/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ authentication cookies, and can be used to gain access to your account.
## Errors and status codes

In the case of an error, the response will be returned as json with an `error_type` field giving an error type you can
match against in your code, an `error` field giving details of what happened and a `url` field that includes any FA url
that the error originated from.
match against in your code, an `error` field giving details of what happened and, optionally, a `url` field that
includes any FA url that the error originated from.

~~~json
{
Expand Down

0 comments on commit 32f1e00

Please sign in to comment.