ipums / ipumspy

Mozilla Public License 2.0
8 stars 6 forks source link

extract_status function doesn't check for HTTP 404 return status #13

Closed franfabrizio closed 3 years ago

franfabrizio commented 3 years ago

If the user tries to request a non-existent extract number, the API will return:

{
    "status": 404,
    "error": "Not Found"
}

ipumspy currently doesn't correctly detect this and so tries to parse this as if it were an actual extract payload.

Ideally it would detect this and relay the error message to the user.

khwilson commented 3 years ago

Does it return an HTTP 404 as well, or is it a 200 with this in the body?

franfabrizio commented 3 years ago

Yep, 404 status is returned as well. Here's the postman view of what came back:

[image: image.png]

On Thu, Oct 14, 2021 at 8:24 AM Kevin Wilson @.***> wrote:

Does it return an HTTP 404 as well, or is it a 200 with this in the body?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ipums/ipumspy/issues/13#issuecomment-943353808, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP3OVY2JDUNWHJKAQNG47LUG3KX7ANCNFSM5F6WGKFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

khwilson commented 3 years ago

Here is one potential solution: #14

khwilson commented 3 years ago

Bug addressed! Solution merged.