Skip to content

empty-catch: core/src/exchanges/myriad/fetcher.ts:203 — orderbook fetch failure silently returns null #938

@realfishsam

Description

@realfishsam

Violation

try {
    const response = await this.ctx.http.get(`${this.baseUrl}/markets/${marketId}/orderbook`, {
        params: { network_id: Number(networkId), outcome },
        headers: this.ctx.getHeaders(),
    });
    const data = response.data;
    if (data.error) return null;
    return { bids: data.bids || [], asks: data.asks || [] };
} catch {
    return null;
}

Location

core/src/exchanges/myriad/fetcher.ts:203

Why It Matters

Any HTTP error, network timeout, or JSON parse failure in the Myriad orderbook fetch is silently swallowed. The caller receives null with no indication that something went wrong. In production, a Myriad API outage or a breaking protocol change would be completely invisible — the exchange would appear to return empty books rather than raising an error.

Suggested Fix

} catch (err) {
    logger.warn('MyriadFetcher: fetchRawOutcomeOrderBook failed', { marketId, error: String(err) });
    return null;
}

Found by automated code hygiene audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions