app-cloudep-notification-se.../pkg/domain/error.go

29 lines
712 B
Go

package domain
import (
"fmt"
"strings"
ers "code.30cm.net/digimon/library-go/errs"
"code.30cm.net/digimon/library-go/errs/code"
"github.com/zeromicro/go-zero/core/logx"
)
func ThirdPartyError(scope uint32, ec ers.ErrorCode, s ...string) *ers.LibError {
return ers.NewError(scope, code.ThirdParty, ec.ToUint32(), fmt.Sprintf("thirty error: %s", strings.Join(s, " ")))
}
func ThirdPartyErrorL(scope uint32, ec ers.ErrorCode,
l logx.Logger, filed []logx.LogField, s ...string) *ers.LibError {
e := ThirdPartyError(scope, ec, s...)
l.WithCallerSkip(1).WithFields(filed...).Error(e.Error())
return e
}
const (
NotificationErrorCode = 1 + iota
FailedToSendEmailErrorCode
FailedToSendSMSErrorCode
)