42 lines
783 B
Go
42 lines
783 B
Go
|
package zerr
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"gitlab.bareksa.com/backend/zen/core/zoptions"
|
||
|
)
|
||
|
|
||
|
type WrapInitialInput struct {
|
||
|
Error error
|
||
|
Message string
|
||
|
PC uintptr
|
||
|
Time time.Time
|
||
|
Logger Logger
|
||
|
Notifier Notifier
|
||
|
}
|
||
|
|
||
|
type Wrapper interface {
|
||
|
// Wrap creates a zerr.Error with inputs
|
||
|
// generated by global entry points.
|
||
|
Wrap(input WrapInitialInput) Error
|
||
|
}
|
||
|
|
||
|
type Logger interface {
|
||
|
Log(ctx context.Context, err Error)
|
||
|
}
|
||
|
|
||
|
type Notifier interface {
|
||
|
Notify(ctx context.Context, err Error, opts ...zoptions.NotifyOption)
|
||
|
}
|
||
|
|
||
|
type WrapperFunc func(input WrapInitialInput) Error
|
||
|
|
||
|
func (wr WrapperFunc) Wrap(input WrapInitialInput) Error {
|
||
|
return wr(input)
|
||
|
}
|
||
|
|
||
|
var DefaultWrapper Wrapper = WrapperFunc(func(input WrapInitialInput) Error {
|
||
|
panic("not implemented")
|
||
|
})
|