better message formatting
Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
This commit is contained in:
@@ -42,7 +42,7 @@ func (mb *MessageBuilderImp) AddData(key, value string) mmail.MailBuilder {
|
||||
|
||||
func (mb *MessageBuilderImp) Build() (mmail.Message, error) {
|
||||
if len(mb.message.recipients) == 0 {
|
||||
return nil, merrors.InvalidArgument("Recipient not set")
|
||||
return nil, merrors.InvalidArgument("Recipient not set", "recipients")
|
||||
}
|
||||
return mb.message, nil
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func (c *Client) Send(r mmail.MailBuilder) error {
|
||||
c.logger.Warn("Malformed messge", zap.String("template_id", m.TemplateID()),
|
||||
zap.String("locale", m.Locale()), zap.Strings("recipients", m.Recipients()),
|
||||
zap.Int("body_size", len(body)))
|
||||
return merrors.InvalidArgument("malformed message")
|
||||
return merrors.InvalidArgument("malformed message", "message.body", "message.recipients")
|
||||
}
|
||||
subj, err := mailkey.Subject(c.l, m.Parameters(), m.TemplateID(), m.Locale())
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/tech/sendico/notification/interface/api/localizer"
|
||||
notification "github.com/tech/sendico/notification/interface/services/notification/config"
|
||||
mi "github.com/tech/sendico/notification/internal/server/notificationimp/mail/internal"
|
||||
@@ -9,7 +10,6 @@ import (
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/messaging"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ type Config = notification.Config
|
||||
|
||||
func createMailClient(logger mlogger.Logger, producer messaging.Producer, l localizer.Localizer, dp domainprovider.DomainProvider, config *Config) (Client, error) {
|
||||
if len(config.Driver) == 0 {
|
||||
return nil, merrors.InvalidArgument("Mail driver name must be provided")
|
||||
return nil, merrors.InvalidArgument("Mail driver name must be provided", "config.driver")
|
||||
}
|
||||
logger.Info("Connecting mail client...", zap.String("driver", config.Driver))
|
||||
if config.Driver == "dummy" {
|
||||
@@ -45,7 +45,7 @@ func createMailClient(logger mlogger.Logger, producer messaging.Producer, l loca
|
||||
|
||||
return mi.NewClient(logger, l, dp, &gsmconfing), nil
|
||||
}
|
||||
return nil, merrors.InvalidArgument("Unkwnown mail driver: " + config.Driver)
|
||||
return nil, merrors.InvalidArgument("Unkwnown mail driver: "+config.Driver, "config.driver")
|
||||
}
|
||||
|
||||
func CreateMailClient(logger mlogger.Logger, sender string, producer messaging.Producer, l localizer.Localizer, dp domainprovider.DomainProvider, config *Config) (Client, error) {
|
||||
|
||||
Reference in New Issue
Block a user