Skip to content

Commit

Permalink
Merge pull request #67 from muzzammilshahid/fix-dealer-error
Browse files Browse the repository at this point in the history
dealer: correctly handle error message
  • Loading branch information
muzzammilshahid authored Aug 1, 2024
2 parents 55b121b + e94b535 commit b722ee9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dealer.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ func (d *Dealer) ReceiveMessage(sessionID int64, msg messages.Message) (*Message
return nil, fmt.Errorf("dealer: only expected to receive error in response to invocation")
}

pending, exists := d.pendingCalls[sessionID]
pending, exists := d.pendingCalls[wErr.RequestID()]
if !exists {
return nil, fmt.Errorf("dealer: no pending calls for session %d", sessionID)
return nil, fmt.Errorf("dealer: no pending invocation for %d", wErr.RequestID())
}

delete(d.pendingCalls, sessionID)
delete(d.pendingCalls, wErr.RequestID())

wErr = messages.NewError(pending.RequestID, messages.MessageTypeCall, map[string]any{}, wErr.URI(),
wErr = messages.NewError(messages.MessageTypeCall, pending.RequestID, wErr.Details(), wErr.URI(),
wErr.Args(), wErr.KwArgs())
return &MessageWithRecipient{Message: wErr, Recipient: pending.CallerID}, nil
default:
Expand Down

0 comments on commit b722ee9

Please sign in to comment.