Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This error indicates that the request does not have valid authentication credent
func SensitiveOperation(ctx context.Context) error {
user, ok := user.FromContext(ctx)
if !ok {
return nil, faults.Unauthenticated
return faults.Unauthenticated
}

// Perform operation
Expand Down Expand Up @@ -147,10 +147,10 @@ It must not be used for rejections caused by exhausting some resource. It must a
func SensitiveResource(ctx context.Context) error {
user, ok := user.FromContext(ctx)
if !ok {
return nil, faults.Unauthenticated
return faults.Unauthenticated
}
if !user.IsAdmin() {
return nil, faults.PermissionDenied
return faults.PermissionDenied
}

// Perform operation
Expand Down
1 change: 1 addition & 0 deletions faults.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func WithResourceExhausted(parent error, violations ...*QuotaViolation) error {
return &QuotaFailure{parent, violations}
}

// WithUnimplemented wraps `parent` with an `UnimplementedFailure`
func WithUnimplemented(parent error) error {
return &UnimplementedFailure{parent}
}
Expand Down
Loading