package apperror import "runtime" type AbortError struct { code int source SourceLocation err error } func NewAbortError(err error, code int) *AbortError { var location SourceLocation if _, file, line, ok := runtime.Caller(1); ok { location = SourceLocation{File: file, Line: line} } return &AbortError{ code: code, source: location, err: err, } } func (e AbortError) Error() string { return e.err.Error() } func (e AbortError) AbortError() (int, error) { return e.code, e.err } func (e AbortError) Unwrap() error { return e.err } func (e AbortError) SourceLocation() SourceLocation { return e.source }