Summary
Python hosted error classes in sdks/python/pmxt/_hosted_errors.py each define a DEFAULT_CODE class variable that is used as the PmxtError.code. TypeScript hosted error classes in sdks/typescript/pmxt/hosted-errors.ts do NOT set an explicit code — they inherit the code from their parent error class (e.g., InvalidOrder, InsufficientFunds), which is a completely different value.
This means e.code returns systematically different strings between the two SDKs for every hosted error subclass.
Complete mismatch table
| Error class |
TypeScript .code (inherited from parent) |
Python .code (DEFAULT_CODE) |
HostedTradingError |
"UNKNOWN_ERROR" (base PmxtError default — hosted-errors.ts:37 calls super(detail)) |
"HOSTED_TRADING_ERROR" (_hosted_errors.py:27) |
InsufficientEscrowBalance |
"INSUFFICIENT_FUNDS" (inherits InsufficientFunds — hosted-errors.ts:44) |
"INSUFFICIENT_ESCROW_BALANCE" (_hosted_errors.py:46) |
OrderSizeTooSmall |
"INVALID_ORDER" (inherits InvalidOrder — hosted-errors.ts:57) |
"ORDER_SIZE_TOO_SMALL" (_hosted_errors.py:53) |
InvalidApiKey |
"AUTHENTICATION_ERROR" (inherits AuthenticationError — hosted-errors.ts:70) |
"INVALID_API_KEY" (_hosted_errors.py:58) |
OutcomeNotFound |
"NOT_FOUND" (inherits NotFoundError — hosted-errors.ts:83) |
"OUTCOME_NOT_FOUND" (_hosted_errors.py:63) |
CatalogUnavailable |
"EXCHANGE_NOT_AVAILABLE" (inherits ExchangeNotAvailable — hosted-errors.ts:96) |
"CATALOG_UNAVAILABLE" (_hosted_errors.py:71) |
BuiltOrderExpired |
"INVALID_ORDER" (inherits InvalidOrder — hosted-errors.ts:109) |
"BUILT_ORDER_EXPIRED" (_hosted_errors.py:79) |
InvalidSignature |
"AUTHENTICATION_ERROR" (inherits AuthenticationError — hosted-errors.ts:122) |
"INVALID_SIGNATURE" (_hosted_errors.py:86) |
NoLiquidity |
"INVALID_ORDER" (inherits InvalidOrder — hosted-errors.ts:135) |
"NO_LIQUIDITY" (_hosted_errors.py:93) |
File locations
- TypeScript:
sdks/typescript/pmxt/hosted-errors.ts (lines 36–156)
- Python:
sdks/python/pmxt/_hosted_errors.py (lines 27–97)
Impact
- Error-handling code that switches on
e.code to identify specific hosted failures will behave differently in each SDK.
- TypeScript collapses multiple distinct failures into the same parent code (e.g.,
OrderSizeTooSmall and NoLiquidity both produce "INVALID_ORDER"), making granular programmatic handling impossible in TypeScript using the code property.
- Logging/monitoring systems that emit
e.code will see incompatible values across SDKs for the same upstream error.
Summary
Python hosted error classes in
sdks/python/pmxt/_hosted_errors.pyeach define aDEFAULT_CODEclass variable that is used as thePmxtError.code. TypeScript hosted error classes insdks/typescript/pmxt/hosted-errors.tsdo NOT set an explicit code — they inherit the code from their parent error class (e.g.,InvalidOrder,InsufficientFunds), which is a completely different value.This means
e.codereturns systematically different strings between the two SDKs for every hosted error subclass.Complete mismatch table
.code(inherited from parent).code(DEFAULT_CODE)HostedTradingError"UNKNOWN_ERROR"(basePmxtErrordefault —hosted-errors.ts:37callssuper(detail))"HOSTED_TRADING_ERROR"(_hosted_errors.py:27)InsufficientEscrowBalance"INSUFFICIENT_FUNDS"(inheritsInsufficientFunds—hosted-errors.ts:44)"INSUFFICIENT_ESCROW_BALANCE"(_hosted_errors.py:46)OrderSizeTooSmall"INVALID_ORDER"(inheritsInvalidOrder—hosted-errors.ts:57)"ORDER_SIZE_TOO_SMALL"(_hosted_errors.py:53)InvalidApiKey"AUTHENTICATION_ERROR"(inheritsAuthenticationError—hosted-errors.ts:70)"INVALID_API_KEY"(_hosted_errors.py:58)OutcomeNotFound"NOT_FOUND"(inheritsNotFoundError—hosted-errors.ts:83)"OUTCOME_NOT_FOUND"(_hosted_errors.py:63)CatalogUnavailable"EXCHANGE_NOT_AVAILABLE"(inheritsExchangeNotAvailable—hosted-errors.ts:96)"CATALOG_UNAVAILABLE"(_hosted_errors.py:71)BuiltOrderExpired"INVALID_ORDER"(inheritsInvalidOrder—hosted-errors.ts:109)"BUILT_ORDER_EXPIRED"(_hosted_errors.py:79)InvalidSignature"AUTHENTICATION_ERROR"(inheritsAuthenticationError—hosted-errors.ts:122)"INVALID_SIGNATURE"(_hosted_errors.py:86)NoLiquidity"INVALID_ORDER"(inheritsInvalidOrder—hosted-errors.ts:135)"NO_LIQUIDITY"(_hosted_errors.py:93)File locations
sdks/typescript/pmxt/hosted-errors.ts(lines 36–156)sdks/python/pmxt/_hosted_errors.py(lines 27–97)Impact
e.codeto identify specific hosted failures will behave differently in each SDK.OrderSizeTooSmallandNoLiquidityboth produce"INVALID_ORDER"), making granular programmatic handling impossible in TypeScript using the code property.e.codewill see incompatible values across SDKs for the same upstream error.