@@ -62,7 +62,7 @@ func (self *Builder) build() {
|
||||
)
|
||||
}
|
||||
|
||||
func (self *Builder) Throw(ctx *context.Context) *Builder {
|
||||
func (self *Builder) Throw(ctx context.Context) *Builder {
|
||||
self.build()
|
||||
if self.Error != nil {
|
||||
ErrorHandler(ctx, self.Status, self.ErrorCode, self.Error)
|
||||
|
||||
@@ -5,15 +5,15 @@ import (
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
func ErrorHandler(ctx *context.Context, status string, errorCode string, err error) {
|
||||
func ErrorHandler(ctx context.Context, status string, errorCode string, err error) {
|
||||
switch status {
|
||||
case StatusSuccess:
|
||||
slog.InfoContext(*ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
slog.InfoContext(ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
case StatusUser:
|
||||
slog.WarnContext(*ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
slog.WarnContext(ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
case StatusServer:
|
||||
slog.ErrorContext(*ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
slog.ErrorContext(ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
case StatusClient:
|
||||
slog.ErrorContext(*ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
slog.ErrorContext(ctx, "Service exception! ErrId: "+errorCode, "id", errorCode, "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user