]> Cypherpunks.ru repositories - nncp.git/commitdiff
Do not fail during hasher deletion
authorSergey Matveev <stargrave@stargrave.org>
Mon, 1 Mar 2021 09:45:12 +0000 (12:45 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 1 Mar 2021 09:45:12 +0000 (12:45 +0300)
src/humanizer.go

index c0de50ff63f5975ecf289baa781cdf6fa620f2b4..a4e0a278305c6084de70dad47eaa0bf0d8e13189 100644 (file)
@@ -244,9 +244,12 @@ func (ctx *Ctx) Humanize(le map[string]string) (string, error) {
                default:
                        return "", errors.New("unknown XX")
                }
-               fullsize, err := strconv.ParseUint(le["FullSize"], 10, 64)
-               if err != nil {
-                       return "", err
+               fullsize := uint64(1)
+               if raw, exists := le["FullSize"]; exists {
+                       fullsize, err = strconv.ParseUint(raw, 10, 64)
+                       if err != nil {
+                               return "", err
+                       }
                }
                msg += fmt.Sprintf(
                        "%s %d%% (%s / %s)",
@@ -255,6 +258,12 @@ func (ctx *Ctx) Humanize(le map[string]string) (string, error) {
                        humanize.IBytes(uint64(sizeParsed)),
                        humanize.IBytes(uint64(fullsize)),
                )
+               if m, exists := le["Msg"]; exists {
+                       msg += ": " + m
+               }
+               if err, exists := le["Err"]; exists {
+                       msg += ": " + err
+               }
        case "sp-done":
                switch le["XX"] {
                case "rx":