5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-10 03:10:26 +00:00

Print errors as string instead of %#v (#738)

This commit is contained in:
Wim 2019-02-26 17:21:23 +01:00 committed by GitHub
parent 740b5f2602
commit b09a73040f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -246,7 +246,7 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
b.Log.Debugf("Setting webhook channel to \"%s\"", msg.Channel) b.Log.Debugf("Setting webhook channel to \"%s\"", msg.Channel)
_, err := b.c.WebhookEdit(wID, "", "", channelID) _, err := b.c.WebhookEdit(wID, "", "", channelID)
if err != nil { if err != nil {
b.Log.Errorf("Could not set webhook channel: %v", err) b.Log.Errorf("Could not set webhook channel: %s", err)
return "", err return "", err
} }
} }
@ -278,7 +278,7 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
rmsg.Text = helper.ClipMessage(rmsg.Text, MessageLength) rmsg.Text = helper.ClipMessage(rmsg.Text, MessageLength)
if _, err := b.c.ChannelMessageSend(channelID, rmsg.Username+rmsg.Text); err != nil { if _, err := b.c.ChannelMessageSend(channelID, rmsg.Username+rmsg.Text); err != nil {
b.Log.Errorf("Could not send message %#v: %v", rmsg, err) b.Log.Errorf("Could not send message %#v: %s", rmsg, err)
} }
} }
// check if we have files to upload (from slack, telegram or mattermost) // check if we have files to upload (from slack, telegram or mattermost)
@ -360,7 +360,7 @@ func (b *Bdiscord) handleUploadFile(msg *config.Message, channelID string) (stri
} }
_, err = b.c.ChannelMessageSendComplex(channelID, &m) _, err = b.c.ChannelMessageSendComplex(channelID, &m)
if err != nil { if err != nil {
return "", fmt.Errorf("file upload failed: %#v", err) return "", fmt.Errorf("file upload failed: %s", err)
} }
} }
return "", nil return "", nil

View File

@ -25,7 +25,7 @@ func (b *Bdiscord) getNick(user *discordgo.User) string {
// If we didn't find nick, search for it. // If we didn't find nick, search for it.
member, err := b.c.GuildMember(b.guildID, user.ID) member, err := b.c.GuildMember(b.guildID, user.ID)
if err != nil { if err != nil {
b.Log.Warnf("Failed to fetch information for member %#v: %#v", user, err) b.Log.Warnf("Failed to fetch information for member %#v: %s", user, err)
return user.Username return user.Username
} else if member == nil { } else if member == nil {
b.Log.Warnf("Got no information for member %#v", user) b.Log.Warnf("Got no information for member %#v", user)