diff --git a/package.json b/package.json index 8d2a28cd..e2b00574 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/nodejs-sdk", - "version": "1.6.0", + "version": "1.6.1", "description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)", "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/src/neynar-api/v1/client.ts b/src/neynar-api/v1/client.ts index 2b63843a..122bd4cf 100644 --- a/src/neynar-api/v1/client.ts +++ b/src/neynar-api/v1/client.ts @@ -79,6 +79,10 @@ export class NeynarV1APIClient { if (NeynarV1APIClient.isApiErrorResponse(error)) { const apiErrors = error.response.data; this.logger.warn(`API errors: ${JSON.stringify(apiErrors)}`); + } else { + this.logger.warn( + `Unexpected error: ${JSON.stringify(error, null, 2)}` + ); } throw error; } @@ -109,9 +113,8 @@ export class NeynarV1APIClient { error: any ): error is SetRequired, "response"> { if (!(error instanceof AxiosError)) return false; - return ( - error.response?.data !== undefined && "message" in error.response.data - ); + const data = error.response?.data; + return typeof data === "object" && data !== null && "message" in data; } // ------------ User ------------