Skip to content

Python SDK's pmxt/__init__.py omits NotSupported and all 9 hosted error subclasses — TypeScript SDK exports all of them from its package root #2364

Closed as duplicate

Description

@realfishsam

Gap

The TypeScript SDK re-exports every error class — the base CCXT-style hierarchy, NotSupported, and all 9 hosted-trading error subclasses — directly from its package root, so import { NotSupported, InvalidSignature } from 'pmxtjs' works. The Python SDK's pmxt/__init__.py only imports the 14 base/legacy error classes; it omits NotSupported entirely and omits every hosted error class (HostedTradingError, InsufficientEscrowBalance, OrderSizeTooSmall, InvalidApiKey, OutcomeNotFound, CatalogUnavailable, BuiltOrderExpired, InvalidSignature, NoLiquidity, MissingWalletAddress). Python callers must reach into pmxt.errors (for NotSupported, via a lazy __getattr__) or the underscore-prefixed pmxt._hosted_errors module directly — from pmxt import NotSupported / from pmxt import InvalidSignature both fail with ImportError in Python where the TypeScript equivalents succeed.

This matters in practice: client.py itself raises InvalidSignature and other hosted errors internally (e.g. client.py:3182), so a Python caller catching hosted-trading errors is forced to know about and import from a module whose name (leading underscore) signals "internal, do not import."

Core

Error hierarchy origin: core/src/utils/error-mapper.ts / the general BaseError hierarchy, plus the hosted-trading error hierarchy referenced throughout core/docs/ERRORS.md and docs/api-reference/errors.mdx (PmxtError → NotSupported; HostedTradingError → InsufficientEscrowBalance, OrderSizeTooSmall, InvalidApiKey, OutcomeNotFound, CatalogUnavailable, BuiltOrderExpired, InvalidSignature, NoLiquidity, MissingWalletAddress).

TypeScript SDK

sdks/typescript/index.ts:35-36:

export * from "./pmxt/errors.js";
export * from "./pmxt/hosted-errors.js";

sdks/typescript/pmxt/errors.ts:119 declares export class NotSupported extends PmxtError, and hosted-errors.ts declares the full HostedTradingError hierarchy — both fully reachable as import { NotSupported, InvalidSignature, HostedTradingError } from 'pmxtjs'.

Python SDK

sdks/python/pmxt/__init__.py:27-42 imports only:

from .errors import (
    PmxtError, BadRequest, AuthenticationError, PermissionDenied,
    NotFoundError, OrderNotFound, MarketNotFound, EventNotFound,
    RateLimitExceeded, InvalidOrder, InsufficientFunds, ValidationError,
    NetworkError, ExchangeNotAvailable,
)

NotSupported (sdks/python/pmxt/errors.py:172) and the 9 hosted error subclasses (lazily re-exported by pmxt.errors via __getattr__, errors.py:193-197, sourced from sdks/python/pmxt/_hosted_errors.py) are never imported into __init__.py and so are absent from the top-level pmxt namespace.

Evidence

Grepped sdks/python/pmxt/__init__.py for NotSupported, HostedTradingError, InvalidSignature, MissingWalletAddress — zero matches anywhere in the file. Read sdks/typescript/index.ts:35-36 confirming the TS package root does export * from both errors.js and hosted-errors.js, and confirmed NotSupported is declared as a top-level export in errors.ts:119.

Impact

Python callers cannot write except pmxt.NotSupported or except pmxt.InvalidSignature — they must know to import from pmxt.errors (works, via the lazy getattr) or pmxt._hosted_errors (an underscore-prefixed module that reads as private/internal and isn't documented as an import path). This is a real ergonomic and discoverability gap between the two SDKs for a very common error-handling pattern, especially for hosted-trading errors that core code raises directly.


Found by automated Core-to-SDK surface coverage audit

Activity

  1. realfishsam commented on Sep 29, 2026

    @realfishsam
    ContributorAuthor

    Closing as duplicate of #985 (NotSupported missing from Python package root) and #1329 (hosted error classes missing from Python package root). This issue is the union of those two existing findings; no additional detail to copy over.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions