repo: Reword min-free-space-size option's error strings
authorUmang Jain <umang@endlessm.com>
Thu, 5 Jul 2018 11:37:34 +0000 (17:07 +0530)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 6 Jul 2018 19:59:11 +0000 (19:59 +0000)
It is important that we use user-friendly error strings. The reason
being error strings are seen by users such as in GNOME Software's
error banner.

Closes: #1671
Approved by: jlebon

src/libostree/ostree-repo.c

index 53d5cfdab566b6c3f66932c86ba392345861d9d8..cae38e6d85850de966d988932ab2e96466ebcd57 100644 (file)
@@ -2670,7 +2670,7 @@ min_free_space_size_validate_and_convert (OstreeRepo    *self,
 
   g_autoptr(GMatchInfo) match = NULL;
   if (!g_regex_match (regex, min_free_space_size_str, 0, &match))
-    return glnx_throw (error, "Failed to match '^[0-9]+[GMT]B$'");
+    return glnx_throw (error, "It should be of the format '123MB', '123GB' or '123TB'");
 
   g_autofree char *size_str = g_match_info_fetch (match, 1);
   g_autofree char *unit = g_match_info_fetch (match, 2);
@@ -2693,7 +2693,7 @@ min_free_space_size_validate_and_convert (OstreeRepo    *self,
 
   guint64 min_free_space = g_ascii_strtoull (size_str, NULL, 10);
   if (shifts > 0 && g_bit_nth_lsf (min_free_space, 63 - shifts) != -1)
-    return glnx_throw (error, "Integer overflow detected");
+    return glnx_throw (error, "Value was too high");
 
   self->min_free_space_mb = min_free_space << shifts;