AppError.Forbidden
Overview
Forbidden returns a 403 AppError.
If you are coming from Node.js, the closest pattern is createError(403, msg).
Method on AppError — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func Forbidden(message string) *AppErrorCompare: Node.js · Standard Go · gox
js
next(createError(403, 'forbidden'));go
return fmt.Errorf("forbidden")go
import "github.com/sahilkhaire/gox/err"
return err.Forbidden("forbidden")Example
go
import "github.com/sahilkhaire/gox/err"
return err.Forbidden("forbidden")Tips
Obtain a AppError value first (see constructors on the package overview), then call Forbidden.
Standard library alternative
Use the standard library directly:
go
return fmt.Errorf("forbidden")