Skip to content

Commit

Permalink
chore: ERROR events may come in, in which case you should throw.
Browse files Browse the repository at this point in the history
  • Loading branch information
kahirokunn committed Jun 21, 2024
1 parent 850c0ed commit 90c1401
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/kubekit-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kubekit/client",
"version": "0.2.19",
"version": "0.2.20",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "kahirokunn",
Expand Down
4 changes: 2 additions & 2 deletions packages/kubekit-client/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export type Context = {
resourceVersion: string;
};
export type WatchEventType = 'ADDED' | 'MODIFIED' | 'DELETED';
export type InnerWatchEventType = WatchEventType | 'BOOKMARK';
export type InnerWatchEventType = WatchEventType | 'BOOKMARK' | 'ERROR';
type WatchEvent<T> = { type: WatchEventType; object: T };
type FinalizerEvent<T extends K8sObj> = {
type: 'ADDED' | 'MODIFIED';
Expand Down Expand Up @@ -352,7 +352,7 @@ export async function apiClient<Response>(
for await (const k8sObj of (response.body as ReadableStream<Uint8Array>).pipeThrough(
new JsonStream<InnerWatchEvent<K8sObj>>()
)) {
if (isKubernetesError(k8sObj)) {
if (isKubernetesError(k8sObj) || k8sObj.type === 'ERROR') {
throw k8sObj;
}

Expand Down

0 comments on commit 90c1401

Please sign in to comment.