Skip to content

Commit

Permalink
Merge pull request #2192 from cjihrig/patch-example
Browse files Browse the repository at this point in the history
examples: fix confusing patch example code
  • Loading branch information
k8s-ci-robot authored Jan 31, 2025
2 parents 9aa9842 + d7b85cf commit 3718aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions examples/patch-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ try {
},
post: async (responseContext) => responseContext,
});
let currentContext = kc.getCurrentContext();
let currentCluster = kc.getCluster(currentContext);
if (currentCluster === undefined || currentCluster === null) {
let currentCluster = kc.getCurrentCluster();
if (currentCluster === null) {
throw new Error('Cluster is undefined');
}
let server = currentCluster.server;
Expand Down
5 changes: 2 additions & 3 deletions examples/typescript/patch/patch-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ try {
},
post: async (responseContext: ResponseContext) => responseContext,
});
const currentContext = kc.getCurrentContext();
const currentCluster = kc.getCluster(currentContext);
if (currentCluster === undefined || currentCluster === null) {
const currentCluster = kc.getCurrentCluster();
if (currentCluster === null) {
throw new Error('Cluster is undefined');
}
const server = currentCluster.server;
Expand Down

0 comments on commit 3718aa6

Please sign in to comment.