Wildberries API TypeScript SDK / BidOutOfRangeError
Class: BidOutOfRangeError
Defined in: errors/bid-out-of-range-error.ts:137
Error thrown when WB rejects a bid for being out of the accepted range.
Wildberries advert endpoints reject out-of-range bids with an HTTP 400 whose RFC 7807 body looks like:
{
"detail": "wrong bid value: 3; min: 150",
"title": "invalid payload",
"status": 400
}BaseClient detects this shape and throws BidOutOfRangeError instead of a generic ValidationError, exposing the parsed floor (and ceiling when reported) directly. This is high-value for auto-bidding engines: the canonical minimum is available from the error itself, avoiding a separate getBidsRecommendations round-trip (which is capped at 5 req/min).
This error is a subclass of ValidationError, so existing catch (error) { if (error instanceof ValidationError) ... } blocks still catch it — the change is purely additive.
The received/min/max numeric unit depends on which endpoint rejected the bid: kopecks for updateBids, RUB for setNormqueryBids.
Example
import { BidOutOfRangeError } from 'daytona-wildberries-typescript-sdk';
try {
await sdk.promotion.updateBids({
bids: [{ advert_id: 12345, nm_bids: [{ nm_id: 1, bid_kopecks: 3, placement: 'search' }] }]
});
} catch (error) {
if (error instanceof BidOutOfRangeError) {
console.error(`Bid ${error.received} below minimum ${error.min}`);
// Retry at error.min (the canonical floor)
}
}See
InvalidBidError for the broader bid-validation sibling (legacy; not thrown by BaseClient — reserved for caller-side validation).
Extends
Constructors
Constructor
new BidOutOfRangeError(
message: string,
context?: {
received?: number;
min?: number;
max?: number;
field?: string;
},
response?: unknown,
requestId?: string): BidOutOfRangeError;Defined in: errors/bid-out-of-range-error.ts:155
Creates a BidOutOfRangeError.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | string | Error message (typically the raw WB detail string) |
context? | { received?: number; min?: number; max?: number; field?: string; } | Parsed bid-range context (received/min/max) plus optional field |
context.received? | number | - |
context.min? | number | - |
context.max? | number | - |
context.field? | string | - |
response? | unknown | API response body if available |
requestId? | string | Correlation ID for debugging |
Returns
BidOutOfRangeError
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
<a id="statuscode"></a> statusCode? | readonly | number | HTTP status code if applicable | ValidationError.statusCode | errors/base-error.ts:25 |
<a id="response"></a> response? | readonly | unknown | API response body if available | ValidationError.response | errors/base-error.ts:30 |
<a id="requestid"></a> requestId? | readonly | string | Correlation ID for debugging and tracing requests | ValidationError.requestId | errors/base-error.ts:35 |
<a id="origin"></a> origin? | readonly | string | Origin service identifier from RFC 7807 problem+json responses. Indicates which internal Wildberries service originated the error (e.g., "s2s-api-auth-catalog"). | ValidationError.origin | errors/base-error.ts:43 |
<a id="timestamp"></a> timestamp? | readonly | string | ISO 8601 timestamp from RFC 7807 problem+json responses. Indicates when the error occurred on the server side (e.g., "2024-09-30T06:52:38Z"). | ValidationError.timestamp | errors/base-error.ts:51 |
<a id="received"></a> received? | readonly | number | The bid value WB rejected (the "wrong bid value"). | - | errors/bid-out-of-range-error.ts:139 |
<a id="min"></a> min? | readonly | number | The minimum accepted bid (the floor). | - | errors/bid-out-of-range-error.ts:142 |
<a id="max"></a> max? | readonly | number | The maximum accepted bid (the ceiling), only when WB reports one. | - | errors/bid-out-of-range-error.ts:145 |
<a id="fielderrors"></a> fieldErrors? | readonly | Record<string, string> | Map of field names to their validation error messages | ValidationError.fieldErrors | errors/validation-error.ts:39 |
Methods
getUserMessage()
getUserMessage(): string;Defined in: errors/bid-out-of-range-error.ts:180
Returns a user-friendly error message with the accepted bid range.
Returns
string
Error message naming the rejected bid and the accepted floor/ceiling
Overrides
ValidationError.getUserMessage
toJSON()
toJSON(): {
name: string;
message: string;
statusCode: number;
fieldErrors?: Record<string, string>;
received?: number;
min?: number;
max?: number;
response?: unknown;
requestId?: string;
};Defined in: errors/bid-out-of-range-error.ts:215
Custom JSON serialization to preserve bid-range fields.
Returns
{
name: string;
message: string;
statusCode: number;
fieldErrors?: Record<string, string>;
received?: number;
min?: number;
max?: number;
response?: unknown;
requestId?: string;
}Object representation including received/min/max
| Name | Type | Defined in |
|---|---|---|
name | string | errors/bid-out-of-range-error.ts:216 |
message | string | errors/bid-out-of-range-error.ts:217 |
statusCode | number | errors/bid-out-of-range-error.ts:218 |
fieldErrors? | Record<string, string> | errors/bid-out-of-range-error.ts:219 |
received? | number | errors/bid-out-of-range-error.ts:220 |
min? | number | errors/bid-out-of-range-error.ts:221 |
max? | number | errors/bid-out-of-range-error.ts:222 |
response? | unknown | errors/bid-out-of-range-error.ts:223 |
requestId? | string | errors/bid-out-of-range-error.ts:224 |