Skip to content

Both SDK error base classes missing status (HTTP status code) field from core BaseError #1408

Description

@realfishsam

Gap

The core BaseError class exposes a status: number field representing the HTTP status code associated with the error. Neither PmxtError (TypeScript SDK) nor PmxtError (Python SDK) carries this field, so SDK consumers cannot inspect the HTTP status code from a caught error without resorting to instanceof chains or code string comparisons.

Core

core/src/errors.ts:7-35:

export class BaseError extends Error {
    /** HTTP status code */
    public readonly status: number;
    /** Machine-readable error code */
    public readonly code: string;
    /** Whether the operation can be retried */
    public readonly retryable: boolean;
    /** Which exchange threw the error */
    public readonly exchange?: string;

    constructor(
        message: string,
        status: number,
        code: string,
        retryable: boolean = false,
        exchange?: string
    ) { ... }
}

Each subclass sets a fixed HTTP status: BadRequest → 400, AuthenticationError → 401, PermissionDenied → 403, NotFound/OrderNotFound/MarketNotFound/EventNotFound → 404, RateLimitExceeded → 429, InvalidOrder/InsufficientFunds/ValidationError → 400, NotSupported → 501, NetworkError/ExchangeNotAvailable → 503.

TypeScript SDK

sdks/typescript/pmxt/errors.ts:8-29:

export class PmxtError extends Error {
    public readonly code: string;
    public readonly retryable: boolean;
    public readonly exchange?: string;
    // status is absent
    constructor(
        message: string,
        code: string = "UNKNOWN_ERROR",
        retryable: boolean = false,
        exchange?: string
    ) { ... }
}

status is not a field on PmxtError or any subclass. fromServerError does not populate it.

Python SDK

sdks/python/pmxt/errors.py:13-27:

class PmxtError(Exception):
    def __init__(self, message: str, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: str | None = None) -> None:
        ...
        self.message = message
        self.code = code
        self.retryable = retryable
        self.exchange = exchange
        # status is absent

No status attribute on PmxtError or any subclass.

Evidence

  • core/src/errors.ts:9public readonly status: number;
  • sdks/typescript/pmxt/errors.ts:8-29PmxtError constructor takes (message, code, retryable, exchange), no status parameter or field
  • sdks/python/pmxt/errors.py:16PmxtError.__init__ takes (message, code, retryable, exchange), no status parameter or attribute
  • fromServerError in both SDKs reads code, message, retryable, exchange from the server JSON but never populates status

Impact

  • SDK consumers who want to branch on HTTP status (e.g. if err.status === 429: backoff()) cannot do so with type safety — they must use isinstance(err, RateLimitExceeded) or check err.code == 'RATE_LIMIT_EXCEEDED'.
  • The status field is part of core's documented public error API; its absence from SDK error types means the SDKs cannot serve as drop-in typed alternatives for code that previously inspected err.status.
  • HTTP-generic error handling middleware (e.g. logging pipelines that emit {status, code, message} for every error) must special-case SDK errors rather than reading a unified field.

Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-sdk-gapCore engine capabilities not exposed in SDKs

    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