Return a new error instead of rethrowing a non-existent error

This commit is contained in:
2025-01-30 13:47:48 -05:00
parent 4f577592ba
commit c3059fe899

View File

@@ -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