Skip to content

Commit

Permalink
fix(snowflake) - fix snowflake interceptor (#9190)
Browse files Browse the repository at this point in the history
* fix: fix snowflake interceptor once again

* fix: fix interface SnowflakeExpiredPasswordError
  • Loading branch information
aubin-tchoi authored Dec 6, 2024
1 parent 20fa408 commit 58da8f1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions connectors/src/connectors/snowflake/temporal/cast_known_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ import { ExternalOAuthTokenError } from "@connectors/lib/error";

interface SnowflakeExpiredPasswordError extends Error {
code: number;
name: string;
name: "OperationFailedError";
data: {
nextAction: "PWD_CHANGE";
};
}

function isSnowflakeExpiredPasswordError(
err: unknown
): err is SnowflakeExpiredPasswordError {
return (
typeof err === "object" &&
err !== null &&
"code" in err &&
err.code === 390106 // this is the magic code number for an expired password error, the message says "Specified password has expired. Password must be changed using the Snowflake web console."
err instanceof Error &&
err.name === "OperationFailedError" &&
"data" in err &&
typeof err.data === "object" &&
err.data !== null &&
"nextAction" in err.data &&
err.data.nextAction === "PWD_CHANGE"
);
}

Expand Down

0 comments on commit 58da8f1

Please sign in to comment.