Skip to content

sdk-drift: create_order/build_order validation errors raise ValueError in Python but PmxtError in TypeScript #930

@realfishsam

Description

@realfishsam

Drift

Input-validation failures inside createOrder / create_order and buildOrder / build_order raise different exception types in the two SDKs. TypeScript raises PmxtError; Python raises the built-in ValueError.

TypeScript SDK

sdks/typescript/pmxt/client.ts (lines ~1955, ~2105):

throw new PmxtError("Cannot specify both 'outcome' and 'marketId'/'outcomeId'...");

All validation branches inside buildOrder and createOrder throw PmxtError, which is the SDK's own error hierarchy.

Python SDK

sdks/python/pmxt/client.py (lines ~2427, ~2547):

raise ValueError("Cannot specify both 'outcome' and 'market_id'/'outcome_id'...")

The same validation branches raise Python's built-in ValueError instead of a PmxtError subclass.

Expected

Validation failures should raise a PmxtError subclass in both SDKs. The appropriate subclass is ValidationError (already defined in both sdks/typescript/pmxt/errors.ts and sdks/python/pmxt/errors.py), which carries an optional field / field attribute.

Impact

Users who catch PmxtError (or pmxt.ValidationError) in a try/except block to handle bad-input cases will silently miss validation errors in the Python SDK, because ValueError is not a subclass of PmxtError. Code ported between SDKs requires different exception-handling logic for identical error conditions.


Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    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