优化错误处理相关代码

This commit is contained in:
GoEdgeLab
2023-08-11 16:14:47 +08:00
parent 8356622c84
commit 9c3e66a9ca

View File

@@ -3,7 +3,7 @@
package shared
import (
"errors"
"fmt"
"regexp"
"strings"
)
@@ -50,7 +50,7 @@ func (this *URLPattern) Init() error {
}
reg, err := regexp.Compile(pattern)
if err != nil {
return errors.New("compile '" + pattern + "' failed: " + err.Error())
return fmt.Errorf("compile '%s' failed: %w", pattern, err)
}
this.reg = reg
}