From 0fba550f1ebabb10dd28ed2b02aec195da6f21c2 Mon Sep 17 00:00:00 2001 From: bth Date: Wed, 28 Jan 2026 15:55:46 -0800 Subject: [PATCH] next : better error --- next/next.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/next/next.go b/next/next.go index 5717839..916c14a 100644 --- a/next/next.go +++ b/next/next.go @@ -1,7 +1,6 @@ package next import ( - "errors" "fmt" "log" "os/exec" @@ -14,8 +13,9 @@ import ( ) const ( - CMD = cmd.Next - SUMMARY = "create the next um file and open with emacsclient" + CMD = cmd.Next + SUMMARY = "create the next um file and open with emacsclient" + NEXT_NUM_ERROR = "failed to find number in last file" ) const FILE_REGEXP = `(?m)^([0-9]+)\.[^\.]*\.*md$` @@ -42,7 +42,7 @@ func NumFromLast(l string) (string, error) { res := fileRegexp.FindStringSubmatch(l) num := "" if len(res) < 2 { - return num, errors.New(last.NOT_FOUND_MSG) + return num, fmt.Errorf("%s: %s", NEXT_NUM_ERROR, l) } num = res[1] return num, nil