fetcher: Return NOT_FOUND when the HTTP code is 410 or 404
This will be used by the pull code to download optional data.
This commit is contained in:
parent
fe5dd07772
commit
b6d77f6ad6
|
|
@ -214,7 +214,17 @@ on_request_sent (GObject *object,
|
||||||
msg = soup_request_http_get_message ((SoupRequestHTTP*) object);
|
msg = soup_request_http_get_message ((SoupRequestHTTP*) object);
|
||||||
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
|
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
|
||||||
{
|
{
|
||||||
g_set_error (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
GIOErrorEnum code;
|
||||||
|
switch (msg->status_code)
|
||||||
|
{
|
||||||
|
case 404:
|
||||||
|
case 410:
|
||||||
|
code = G_IO_ERROR_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
code = G_IO_ERROR_FAILED;
|
||||||
|
}
|
||||||
|
g_set_error (&local_error, G_IO_ERROR, code,
|
||||||
"Server returned status %u: %s",
|
"Server returned status %u: %s",
|
||||||
msg->status_code, soup_status_get_phrase (msg->status_code));
|
msg->status_code, soup_status_get_phrase (msg->status_code));
|
||||||
g_simple_async_result_take_error (pending->result, local_error);
|
g_simple_async_result_take_error (pending->result, local_error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue