{"modulePath":"github.com/MayCMF/core","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Variables\n\n```go\nvar (\n\tNew         = errors.New\n\tWrap        = errors.Wrap\n\tWrapf       = errors.Wrapf\n\tWithStack   = errors.WithStack\n\tWithMessage = errors.WithMessage\n)\n```\nDefine an alias\n\n```go\nvar (\n\tErrBadRequest              = New400Response(\"Request error\")\n\tErrInvalidParent           = New400Response(\"Invalid parent node\")\n\tErrNotAllowDeleteWithChild = New400Response(\"Contains children, cannot be deleted\")\n\tErrNotAllowDelete          = New400Response(\"Resources are not allowed to delete\")\n\tErrInvalidUserName         = New400Response(\"Invalid username\")\n\tErrInvalidPassword         = New400Response(\"Invalid password\")\n\tErrInvalidUser             = New400Response(\"Invalid user\")\n\tErrUserDisable             = New400Response(\"User is disabled, please contact administrator\")\n\n\tErrNoPerm          = NewResponse(401, \"No access\", 401)\n\tErrInvalidToken    = NewResponse(9999, \"Token invalidation\", 401)\n\tErrNotFound        = NewResponse(404, \"Resource does not exist.\", 404)\n\tErrMethodNotAllow  = NewResponse(405, \"Method is not allowed\", 405)\n\tErrTooManyRequests = NewResponse(429, \"Request too frequently\", 429)\n\tErrInternalServer  = NewResponse(500, \"Server error\", 500)\n)\n```\nDefinition error\n\n## Functions\n\n```go\nfunc New400Response(msg string) error\n```\nNew400Response - Create a response error with error code 400\n\n```go\nfunc New500Response(msg string) error\n```\nNew500Response - Create a response error with error code 500\n\n```go\nfunc NewResponse(code int, msg string, status ...int) error\n```\nNewResponse - Create response error\n\n```go\nfunc Wrap400Response(err error, msg ...string) error\n```\nWrap400Response - Wrong response error with package error code 400\n\n```go\nfunc Wrap500Response(err error, msg ...string) error\n```\nWrap500Response - Wrong response error with package error code 500\n\n```go\nfunc WrapResponse(err error, code int, msg string, status ...int) error\n```\nWrapResponse - Wrapper response error\n\n## Types\n\n```go\ntype ResponseError struct {\n\tCode       int    // error code\n\tMessage    string // wrong information\n\tStatusCode int    // Response status code\n\tERR        error  // Response error\n}\n```\nResponseError - Define response error\n\n```go\nfunc UnWrapResponse(err error) *ResponseError\n```\nUnWrapResponse - Unpacking response error\n\n```go\nfunc (r *ResponseError) Error() string\n```\n\n","path":"github.com/MayCMF/core/src/common/errors","name":"errors","synopsis":"","isRedistributable":true}
