Skip to content

Commit de5c207

Browse files
committed
[patch] added Newf method for creating new formatted error without type
1 parent ea2ad23 commit de5c207

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: errors.go

+5
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ func New(msg string) *Error {
179179
return newerr(nil, msg, file, line, defaultErrType)
180180
}
181181

182+
func Newf(fromat string, args ...interface{}) *Error {
183+
_, file, line, _ := runtime.Caller(1)
184+
return newerrf(nil, file, line, defaultErrType, fromat, args...)
185+
}
186+
182187
// SetDefaultType will set the default error type, which is used in the 'New' function
183188
func SetDefaultType(e errType) {
184189
defaultErrType = e

0 commit comments

Comments
 (0)