Add helper for generating better permission denied errors

This commit is contained in:
Matt Keeler 2020-06-05 10:43:23 -04:00
parent 9f7b22a5eb
commit 1dba94311a
No known key found for this signature in database
GPG Key ID: 04DBAE1857E0081B
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package acl
import (
"errors"
"fmt"
"strings"
)
@ -70,3 +71,8 @@ func (e PermissionDeniedError) Error() string {
}
return errPermissionDenied
}
func PermissionDenied(msg string, args ...interface{}) PermissionDeniedError {
cause := fmt.Sprintf(msg, args...)
return PermissionDeniedError{Cause: cause}
}