Skip to content

Commit

Permalink
fix: parse non-JSON response objects correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Sep 17, 2024
1 parent d1c6a20 commit a8fe4ad
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/BaseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,21 @@ export class BaseApi {
};

if (response.status < 200 || response.status >= 300) {
const error = (await response.json()) as APIError;
console.log(response);
let error: APIError;
try {
error = (await response.json()) as APIError;
} catch (_) {
throw new StreamError(

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '6a4b36bf-2adb-4ccc-8097-f0b12bbb7e15', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '0ee1d9b3-0330-4a23-9b55-5a003474715e', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '12497bb4-6b57-496d-9b31-b5522039a5e6', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'd84b260e-e648-44b9-b681-cf4eb07034bc', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '75c18abf-9af5-49b8-80e9-13768a6fcec3', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'db380371-8fcb-4a23-ab14-86ca53cd782a', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '8d7257ae-7350-4f92-b3a6-d119785dc538', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (18)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'a63fb6ab-78f9-469a-9fd3-7c4b92233f36', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'd21e1d4b-715a-4403-b5be-d5b426533c0d', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'f64d27d8-c1c7-4dfb-aa4c-d65eb2162141', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '716f6a86-ba0c-4bda-ace0-3df4faea9b89', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '234cfe31-2734-448c-98cf-682938e68ba3', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '18a60e5e-6cbd-4a7c-a5d4-ebebe46dfe24', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-bun

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '03975d33-cdae-4db1-8507-86a00df1a497', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'e1fd8554-4276-4e12-a07a-f6d6636cd8a0', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '44b637a7-e16f-468b-aafd-b74062dbfd93', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'b4ba6350-d7bf-4ae7-ae62-316ff24ac797', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '27809eef-28c9-4356-b9fa-b6c65d3e2dd0', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '5052907b-66c2-489d-ba56-49661104f7aa', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '3aaaffdc-b548-47e4-906b-8a3290a28994', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '1d35db66-276f-452c-b6ec-0c499a16e424', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (20)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'c5b52580-7a84-4fe1-98cc-b57f45b1bf2a', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '67d54d1c-e77a-480b-9dc8-28a7ce8b1b21', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '4ea0785b-8554-4308-bbe8-6c14580e8bf9', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '50a68494-1dae-470d-890e-b0a7319c10c8', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > ban and unban

Error: Stream error: 404 - Not Found ❯ StreamChatClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamChatClient.ChatApi.queryBannedUsers src/gen/chat/ChatApi.ts:1699:22 ❯ __tests__/users.test.ts:106:25 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: 'ec1d04e2-1652-4670-966a-23c5d30d65df', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 404, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 404 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '2fb0b1b6-3969-4bb4-8337-7dcd82444edd', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '6f83a56b-7cff-41c3-bda1-b665a69d75ae', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '1ef0c7a1-bbbe-4f5e-b8ca-f3596d385b46', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }

Check failure on line 60 in src/BaseApi.ts

View workflow job for this annotation

GitHub Actions / test-node (22)

__tests__/users.test.ts > user API > block and unblock

Error: Stream error: 405 - Method Not Allowed ❯ StreamClient.BaseApi.sendRequest src/BaseApi.ts:60:17 ❯ StreamClient.CommonApi.blockUsers src/gen/common/CommonApi.ts:822:22 ❯ __tests__/users.test.ts:152:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { metadata: { clientRequestId: '6a13f60f-a5c2-462a-8c1b-a95d608a6794', responseHeaders: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, responseCode: 405, rateLimit: { rateLimit: undefined, rateLimitRemaining: undefined, rateLimitReset: undefined } }, code: 405 }
`Stream error: ${response.status} - ${response.statusText}`,
metadata,
response.status,
);
}
throw new StreamError(
`Stream error code ${error.code}: ${error.message}`,
`Stream error code ${error!.code}: ${error!.message}`,
metadata,
error.code,
error!.code,
undefined,
);
}
Expand All @@ -65,6 +75,7 @@ export class BaseApi {

return { body: responseBody, metadata };
} catch (error: any) {
console.log(error);
if (error instanceof StreamError) {
throw error;
}
Expand Down

0 comments on commit a8fe4ad

Please sign in to comment.