Fix some error messages

This commit is contained in:
Tulir Asokan 2023-07-16 00:16:36 +03:00
parent 45d5a556ba
commit d04b1bde39
3 changed files with 9 additions and 9 deletions

View file

@ -36,7 +36,7 @@ func (c *Conversations) List(count int64) (*binary.Conversations, error) {
res, ok := response.Data.Decrypted.(*binary.Conversations) res, ok := response.Data.Decrypted.(*binary.Conversations)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into Conversations") return nil, fmt.Errorf("unexpected response type %T, expected *binary.Conversations", response.Data.Decrypted)
} }
return res, nil return res, nil
@ -58,7 +58,7 @@ func (c *Conversations) GetType(conversationId string) (*binary.GetConversationT
res, ok := response.Data.Decrypted.(*binary.GetConversationTypeResponse) res, ok := response.Data.Decrypted.(*binary.GetConversationTypeResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into GetConversationTypeResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.GetConversationTypeResponse", response.Data.Decrypted)
} }
return res, nil return res, nil
@ -84,7 +84,7 @@ func (c *Conversations) FetchMessages(conversationId string, count int64, cursor
res, ok := response.Data.Decrypted.(*binary.FetchMessagesResponse) res, ok := response.Data.Decrypted.(*binary.FetchMessagesResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into FetchMessagesResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.FetchMessagesResponse", response.Data.Decrypted)
} }
return res, nil return res, nil
@ -105,7 +105,7 @@ func (c *Conversations) SendMessage(payload *binary.SendMessagePayload) (*binary
res, ok := response.Data.Decrypted.(*binary.SendMessageResponse) res, ok := response.Data.Decrypted.(*binary.SendMessageResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into SendMessageResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.SendMessageResponse", response.Data.Decrypted)
} }
c.client.Logger.Debug().Any("res", res).Msg("sent message!") c.client.Logger.Debug().Any("res", res).Msg("sent message!")
@ -128,7 +128,7 @@ func (c *Conversations) GetParticipantThumbnail(convID string) (*binary.Particip
res, ok := response.Data.Decrypted.(*binary.ParticipantThumbnail) res, ok := response.Data.Decrypted.(*binary.ParticipantThumbnail)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into ParticipantThumbnail") return nil, fmt.Errorf("unexpected response type %T, expected *binary.ParticipantThumbnail", response.Data.Decrypted)
} }
return res, nil return res, nil
@ -156,7 +156,7 @@ func (c *Conversations) Update(convBuilder *ConversationBuilder) (*binary.Update
res, ok := response.Data.Decrypted.(*binary.UpdateConversationResponse) res, ok := response.Data.Decrypted.(*binary.UpdateConversationResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into UpdateConversationResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.UpdateConversationResponse", response.Data.Decrypted)
} }
return res, nil return res, nil

View file

@ -25,7 +25,7 @@ func (m *Messages) React(payload *binary.SendReactionPayload) (*binary.SendReact
res, ok := response.Data.Decrypted.(*binary.SendReactionResponse) res, ok := response.Data.Decrypted.(*binary.SendReactionResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into SendReactionResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.SendReactionResponse", response.Data.Decrypted)
} }
m.client.Logger.Debug().Any("res", res).Msg("sent reaction!") m.client.Logger.Debug().Any("res", res).Msg("sent reaction!")
@ -48,7 +48,7 @@ func (m *Messages) Delete(messageId string) (*binary.DeleteMessageResponse, erro
res, ok := response.Data.Decrypted.(*binary.DeleteMessageResponse) res, ok := response.Data.Decrypted.(*binary.DeleteMessageResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into DeleteMessageResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.DeleteMessagesResponse", response.Data.Decrypted)
} }
m.client.Logger.Debug().Any("res", res).Msg("deleted message!") m.client.Logger.Debug().Any("res", res).Msg("deleted message!")

View file

@ -38,7 +38,7 @@ func (s *Session) IsBugleDefault() (*binary.IsBugleDefaultResponse, error) {
res, ok := response.Data.Decrypted.(*binary.IsBugleDefaultResponse) res, ok := response.Data.Decrypted.(*binary.IsBugleDefaultResponse)
if !ok { if !ok {
return nil, fmt.Errorf("failed to assert response into IsBugleDefaultResponse") return nil, fmt.Errorf("unexpected response type %T, expected *binary.IsBugleDefaultResponse", response.Data.Decrypted)
} }
return res, nil return res, nil