From 7f8ed1c018d1ef57b6c95213cf1044b868f0d738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Sat, 23 Sep 2023 23:41:00 +0200 Subject: [PATCH] Fix error when technology couldn't be determined --- containers/tools.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/containers/tools.go b/containers/tools.go index 14d716a..7fa3283 100644 --- a/containers/tools.go +++ b/containers/tools.go @@ -2,7 +2,6 @@ package containers import ( "bytes" - "errors" "fmt" "log" "os" @@ -173,7 +172,14 @@ func getTechAndVersion(symlink string) (*TechInfo, error) { re := regexp.MustCompile(`\d+\.\d+\.\d+`) version := re.FindString(parts[1]) if version == "" { - return nil, errors.New("failed to extract version from symlink") + // In case version couldn't be determined we return "unknown", otherwise returning + // error in this case was crashing admin when user fucked up the symlink for the + // tech manually. + log.Println("failed to extract version from symlink") + return &TechInfo{ + Tech: "unknown", + Version: "", + }, nil } return &TechInfo{