Subscription.Fire() can error, so Relay.Subscribe() must also.

This commit is contained in:
fiatjaf
2023-04-06 16:21:25 -03:00
parent 4c9db5928a
commit ef428ff39f
2 changed files with 22 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ package nostr
import (
"context"
"fmt"
"strconv"
"sync"
)
@@ -70,7 +71,7 @@ func (sub *Subscription) Fire() error {
err := sub.conn.WriteJSON(message)
if err != nil {
sub.cancel()
return err
return fmt.Errorf("failed to write: %w", err)
}
// the subscription ends once the context is canceled