{"modulePath":"github.com/knz/errors","version":"v1.2.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package withstack\n\n## Functions\n\n```go\nfunc GetOneLineSource(err error) (file string, line int, fn string, ok bool)\n```\nGetOneLineSource extracts the file/line/function information of the topmost caller in the innermost recorded stack trace. The filename is simplified to remove the path prefix. This is used e.g. to populate the \"source\" field in PostgreSQL errors.\n\n```go\nfunc WithStack(err error) error\n```\nWithStack annotates err with a stack trace at the point WithStack was called.\n\nDetail is shown: - via \\`errors.GetSafeDetails()\\` - when formatting with \\`%+v\\`. - in Sentry reports. - when innermost stack capture, with \\`errors.GetOneLineSource()\\`.\n\n```go\nfunc WithStackDepth(err error, depth int) error\n```\nWithStackDepth annotates err with a stack trace starting from the given call depth. The value zero identifies the caller of WithStackDepth itself. See the documentation of WithStack() for more details.\n\n## Types\n\n```go\ntype Frame = pkgErr.Frame\n```\nFrame is the type of a single call frame entry. This mirrors the type of the same name in github.com/pkg/errors.\n\n```go\ntype ReportableStackTrace = raven.Stacktrace\n```\nReportableStackTrace aliases the type of the same name in the raven (Sentry) package. This is used by the 'report' error package.\n\n```go\nfunc GetReportableStackTrace(err error) *ReportableStackTrace\n```\nGetReportableStackTrace extracts a stack trace embedded in the given error in the format suitable for raven/Sentry reporting.\n\nThis supports:\n\n  - errors generated by github.com/pkg/errors (either generated locally or after transfer through the network),\n  - errors generated with WithStack() in this package,\n  - any other error that implements a StackTrace() method returning a StackTrace from github.com/pkg/errors.\n\nNote: Sentry wants the oldest call frame first, so the entries are reversed in the result.\n\n```go\ntype StackTrace = pkgErr.StackTrace\n```\nStackTrace is the type of the data for a call stack. This mirrors the type of the same name in github.com/pkg/errors.\n\n","path":"github.com/knz/errors/withstack","name":"withstack","synopsis":"","isRedistributable":true}
