@juspay/neurolink 12.14.8 → 12.14.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,7 +69,7 @@ export class LMStudioProvider extends OpenAIChatCompletionsProvider {
69
69
  },
70
70
  ...DEFAULT_ERROR_RULES,
71
71
  ];
72
- return classifyProviderError(error, rules, "lm-studio", this.modelName);
72
+ return classifyProviderError(error, rules, this.providerName, this.modelName);
73
73
  }
74
74
  async validateConfiguration() {
75
75
  return this.probeModelsEndpoint(this.config.apiKey && this.config.apiKey !== LM_STUDIO_PLACEHOLDER_KEY
@@ -281,7 +281,7 @@ export class NvidiaNimProvider extends OpenAIChatCompletionsProvider {
281
281
  },
282
282
  ...DEFAULT_ERROR_RULES,
283
283
  ];
284
- return classifyProviderError(error, rules, "nvidia-nim", this.modelName);
284
+ return classifyProviderError(error, rules, this.providerName, this.modelName);
285
285
  }
286
286
  async validateConfiguration() {
287
287
  return (typeof this.config.apiKey === "string" &&
@@ -136,7 +136,7 @@ export class OllamaProvider extends OpenAIChatCompletionsProvider {
136
136
  },
137
137
  ...DEFAULT_ERROR_RULES,
138
138
  ];
139
- return classifyProviderError(error, rules, "ollama", this.modelName);
139
+ return classifyProviderError(error, rules, this.providerName, this.modelName);
140
140
  }
141
141
  // ===========================================================================
142
142
  // Optional hooks — Ollama-specific behaviour
@@ -149,7 +149,7 @@ export class OpenRouterProvider extends OpenAIChatCompletionsProvider {
149
149
  },
150
150
  ...DEFAULT_ERROR_RULES,
151
151
  ];
152
- return classifyProviderError(error, rules, "openrouter", this.modelName);
152
+ return classifyProviderError(error, rules, this.providerName, this.modelName);
153
153
  }
154
154
  // ===========================================================================
155
155
  // Optional hooks — provider-specific quirks
@@ -85,6 +85,6 @@ export class OpenAICompatibleProvider extends OpenAIChatCompletionsProvider {
85
85
  },
86
86
  ...DEFAULT_ERROR_RULES,
87
87
  ];
88
- return classifyProviderError(error, rules, "openai-compatible", this.modelName);
88
+ return classifyProviderError(error, rules, this.providerName, this.modelName);
89
89
  }
90
90
  }
@@ -5,10 +5,21 @@
5
5
  * Supports multiple time formats: milliseconds, seconds, minutes, hours.
6
6
  */
7
7
  import type { TimeoutConfig, TimeoutResult } from "../types/index.js";
8
+ import { TimeoutError as BaseTimeoutError } from "./async/withTimeout.js";
8
9
  /**
9
- * Custom error class for timeout operations
10
+ * Custom error class for timeout operations.
11
+ *
12
+ * Extends the base {@link BaseTimeoutError} (from `./async/withTimeout.js`)
13
+ * rather than `Error` directly, merging what were two independent internal
14
+ * `TimeoutError` classes onto one prototype chain — an `instanceof` check
15
+ * against either module's `TimeoutError` now recognizes errors thrown by
16
+ * this class. Constructor signature, `.name`, and the extra
17
+ * `timeout`/`provider`/`operation` fields are unchanged so all 15 existing
18
+ * `instanceof TimeoutError` call sites keep working exactly as before;
19
+ * `super(message, timeout)` additionally populates the base class's
20
+ * `timeoutMs` field (equal to `timeout`) as a byproduct.
10
21
  */
11
- export declare class TimeoutError extends Error {
22
+ export declare class TimeoutError extends BaseTimeoutError {
12
23
  readonly timeout: number;
13
24
  readonly provider?: string | undefined;
14
25
  readonly operation?: "generate" | "stream" | undefined;
@@ -4,15 +4,26 @@
4
4
  * Provides flexible timeout parsing and error handling for AI operations.
5
5
  * Supports multiple time formats: milliseconds, seconds, minutes, hours.
6
6
  */
7
+ import { TimeoutError as BaseTimeoutError } from "./async/withTimeout.js";
7
8
  /**
8
- * Custom error class for timeout operations
9
+ * Custom error class for timeout operations.
10
+ *
11
+ * Extends the base {@link BaseTimeoutError} (from `./async/withTimeout.js`)
12
+ * rather than `Error` directly, merging what were two independent internal
13
+ * `TimeoutError` classes onto one prototype chain — an `instanceof` check
14
+ * against either module's `TimeoutError` now recognizes errors thrown by
15
+ * this class. Constructor signature, `.name`, and the extra
16
+ * `timeout`/`provider`/`operation` fields are unchanged so all 15 existing
17
+ * `instanceof TimeoutError` call sites keep working exactly as before;
18
+ * `super(message, timeout)` additionally populates the base class's
19
+ * `timeoutMs` field (equal to `timeout`) as a byproduct.
9
20
  */
10
- export class TimeoutError extends Error {
21
+ export class TimeoutError extends BaseTimeoutError {
11
22
  timeout;
12
23
  provider;
13
24
  operation;
14
25
  constructor(message, timeout, provider, operation) {
15
- super(message);
26
+ super(message, timeout);
16
27
  this.timeout = timeout;
17
28
  this.provider = provider;
18
29
  this.operation = operation;