2024-08-22 17:26:53 +07:00
|
|
|
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 {
|
2024-08-23 10:18:27 +07:00
|
|
|
LogError(ctx context.Context, err Error)
|
2024-08-22 17:26:53 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
type Notifier interface {
|
2024-08-23 10:18:27 +07:00
|
|
|
NotifyError(ctx context.Context, err Error, opts ...zoptions.NotifyOption)
|
2024-08-22 17:26:53 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
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")
|
|
|
|
})
|