From c3059fe899b9a20b697406f9e2f1f5a07704e9ef Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 30 Jan 2025 13:47:48 -0500 Subject: [PATCH] Return a new error instead of rethrowing a non-existent error --- regex/compile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regex/compile.go b/regex/compile.go index ebcb318..5fa56af 100644 --- a/regex/compile.go +++ b/regex/compile.go @@ -627,7 +627,7 @@ func shuntingYard(re string, flags ...ReFlag) ([]postfixNode, error) { case "word": // Word characters nodeToAdd, _ = newEscapedNode('w', true) // This isn't going to error, so I suppress it default: - return nil, err + return nil, fmt.Errorf("invalid POSIX character class") } chars = append(chars, nodeToAdd) i = temp_i + len(posixClass) + 2 // Skip over the class name, the closing colon and the closing bracket