Skip to content

payment-service classifies network failures by message text, same shape as the send bug #99

Description

@TortoiseWolfe

src/lib/payments/payment-service.ts:128-133 has the same structure as the message-send bug fixed in #98:

error.message.includes('fetch') || error.message.includes('network') || error.message.includes('ECONNREFUSED')

…deciding whether to queueOperation. It is a PostgREST .insert().select().single() (:118-122) whose status is available and discarded, exactly as on the send path before #98.

Two consequences, both demonstrated on the messaging side:

  1. WebKit is not covered. Safari reports an aborted fetch as TypeError: Load failed, which matches none of those three substrings. So on Safari a payment that fails at the transport layer is not queued.
  2. No structural guard. A Postgres rejection whose message happens to contain "network" would be misread as a transport failure. fix(messaging): stop discarding the user's message when a send fails #98 addressed this by gating on the PostgREST code (a rejection always carries a SQLSTATE; a fetch failure carries code: '' and status: 0) and by threading the original through as cause so wrapping does not lose it.

Not folded into #98 deliberately — that PR is already broad and touches a different service. The fix is the same shape and should be small: reuse the looksLikeFetchFailure + code-gate approach, or capture status === 0 at the destructure.

Worth checking whether payments has an equivalent of the third bug too: does a failed payment discard user input the way the message composer did?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpayments

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions