Loading...
Loading...
Generate custom Go errors following GO modular architecture conventions using bricks errs.New(code, message, httpStatus, metadata). Use when creating new domain errors, extending internal/modules/<module>/errs/errs.go, or standardizing error codes/messages/statuses in identity and monitor modules.
npx skill4agent add cristiano-pacheco/ai-rules go-create-errorerrsinternal/modules/<module>/errs/errs.gopackage errsnet/httpgithub.com/cristiano-pacheco/bricks/pkg/errsvar (...)errs.New("<MODULE>_<NN>", "<Message>", http.<Status>, nil)package errs
import (
"net/http"
"github.com/cristiano-pacheco/bricks/pkg/errs"
)
var (
// ErrInvalidContactType is returned when contact type is invalid.
ErrInvalidContactType = errs.New("MONITOR_01", "Invalid contact type", http.StatusBadRequest, nil)
// ErrContactNameAlreadyInUse is returned when contact name already exists.
ErrContactNameAlreadyInUse = errs.New("MONITOR_02", "Contact name already in use", http.StatusConflict, nil)
)identitymonitorErrInvalidContactType"Invalid contact type"http.StatusBadRequestinternal/modules/<module>/errs/errs.goIDENTITY_01IDENTITY_02MONITOR_01MONITOR_02var (...)errors.New(...)ErrErrInvalidUserStatusErrOAuthStateNotFound<MODULE>_<NN>IDENTITY_54MONITOR_05http.StatusBadRequesthttp.StatusUnauthorizedhttp.StatusForbiddenhttp.StatusNotFoundhttp.StatusConflicthttp.StatusTooManyRequestshttp.StatusInternalServerErrorhttp.StatusServiceUnavailableinternal/modules/<module>/errs/errs.goErr...errs.New(...)errs.Err...if input.RedirectURI == "" {
return errs.ErrInvalidRedirectURI
}
if user == nil {
return errs.ErrUserNotFound
}internal/modules/<module>/errs