@adaptic/utils 0.0.980 → 0.0.981

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.
package/dist/index.cjs CHANGED
@@ -5846,7 +5846,30 @@ async function getOrders$1(auth, params = {}) {
5846
5846
  return allOrders;
5847
5847
  }
5848
5848
  catch (error) {
5849
- getLogger().error("Error in getOrders:", error);
5849
+ const isTransient = isTransientNetworkError(error);
5850
+ const errMsg = error instanceof Error ? error.message : String(error);
5851
+ const logMeta = {
5852
+ source: "AlpacaLegacy.getOrders",
5853
+ error: errMsg,
5854
+ ...(isTransient
5855
+ ? {
5856
+ transient: true,
5857
+ recoveryHint: "Upstream caller should retry on next cycle",
5858
+ }
5859
+ : {}),
5860
+ };
5861
+ // Transient network errors (fetch timeouts, ECONNRESET) are
5862
+ // recoverable; log at WARN. Non-transient failures (4xx/auth)
5863
+ // stay at ERROR. Previous call also passed the raw Error as the
5864
+ // second argument, which Pino treats as context not as `err`,
5865
+ // producing empty `err` fields in production logs — fix by
5866
+ // serializing to an explicit string message.
5867
+ if (isTransient) {
5868
+ getLogger().warn(`Error in getOrders: ${errMsg}`, logMeta);
5869
+ }
5870
+ else {
5871
+ getLogger().error(`Error in getOrders: ${errMsg}`, logMeta);
5872
+ }
5850
5873
  throw error;
5851
5874
  }
5852
5875
  }