Skip to content

Commit

Permalink
Merge pull request #121 from Deer-Spangle/handle_pending_deletion_error
Browse files Browse the repository at this point in the history
Handle "pending deletion" error
  • Loading branch information
Deer-Spangle authored Mar 12, 2024
2 parents 71364bf + b61e348 commit 4e7543c
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 = html.at_css("table.maintable td.cat")
if !maintable_head.nil? && 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 4e7543c

Please sign in to comment.