aports/community/tootle/0002-Use-reason_phrase-instead-of-get_phrase.patch
2021-10-27 00:19:49 +00:00

56 lines
1.8 KiB
Diff

From 09737d32285f0bad5555be61effab8d512809433 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Tue, 26 Oct 2021 15:21:22 -0700
Subject: [PATCH 2/2] Use reason_phrase instead of get_phrase
Based on the patch here:
https://github.com/bleakgrey/tootle/pull/336
Rebased on 1.0 branch
---
src/Services/Cache.vala | 2 +-
src/Services/Network.vala | 7 +------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/Services/Cache.vala b/src/Services/Cache.vala
index 2251697..2ed314e 100644
--- a/src/Services/Cache.vala
+++ b/src/Services/Cache.vala
@@ -88,7 +88,7 @@ public class Tootle.Cache : GLib.Object {
try {
var code = msg.status_code;
if (code != Soup.Status.OK) {
- var error = network.describe_error (code);
+ var error = msg.reason_phrase;
throw new Oopsie.INSTANCE (@"Server returned $error");
}
diff --git a/src/Services/Network.vala b/src/Services/Network.vala
index fa2839c..d0143b0 100644
--- a/src/Services/Network.vala
+++ b/src/Services/Network.vala
@@ -56,7 +56,7 @@ public class Tootle.Network : GLib.Object {
else if (status == Soup.Status.CANCELLED)
debug ("Message is cancelled. Ignoring callback invocation.");
else
- ecb ((int32) status, describe_error ((int32) status));
+ ecb ((int32) status, msg.reason_phrase);
});
}
catch (Error e) {
@@ -65,11 +65,6 @@ public class Tootle.Network : GLib.Object {
}
}
- public string describe_error (uint code) {
- var reason = Soup.Status.get_phrase (code);
- return @"$code: $reason";
- }
-
public void on_error (int32 code, string message) {
warning (message);
app.toast (message);
--
2.33.1