{"modulePath":"github.com/cryptopay-dev/yaga","version":"v1.18.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Variables\n\n```go\nvar (\n\t// ErrorEmptyLogger issued when logger received empty logger to New-method\n\tErrorEmptyLogger = errors.New(\"options hasn't logger\")\n)\n```\n\n## Types\n\n```go\ntype CustomError interface {\n\tFormatResponse(ctx echo.Context)\n}\n```\n\n```go\ntype Logic struct {\n\tOpts Options\n}\n```\nLogic is an structure for capture and recover web-errors and panics\n\n```go\nfunc New(opts Options) (*Logic, error)\n```\nNew creates instance of Logic structure\n\n```go\nfunc (c *Logic) Capture(err error, ctx echo.Context)\n```\nCapture web-errors and formatting answer\n\n```go\nfunc (c *Logic) Recover() echo.MiddlewareFunc\n```\nRecover is an echo-middleware to capture panics in controllers/actions and send info to sentry\n\n```go\ntype LogicError struct {\n\tCode    int\n\tMessage string\n}\n```\nLogicError used for web-controllers\n\n```go\nfunc NewError(code int, message string) *LogicError\n```\nNewError return LogicError with http-code and error message\n\n```go\nfunc NewErrorf(code int, format string, a ...interface{}) *LogicError\n```\nNewErrorf return LogicError with http-code and formatted error message\n\n```go\nfunc (err *LogicError) Error() string\n```\nError is an implementation of error interface\n\n```go\ntype Options struct {\n\tDebug  bool\n\tLogger logger.Logger\n}\n```\nOptions for creating new Logic\n\n```go\ntype Response struct {\n\tError  string   `json:\"error\"`\n\tStack  []string `json:\"stack\"`\n\tResult []string `json:\"result\"`\n}\n```\nResponse answer structure\n\n","path":"github.com/cryptopay-dev/yaga/errors","name":"errors","synopsis":"","isRedistributable":true}
