Skip to content

Commit

Permalink
errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fredzqm committed May 10, 2024
1 parent 45ed497 commit 7d7a65c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/dataconnect/schemaMigration.ts
Expand Up @@ -28,20 +28,21 @@ export async function diffSchema(schema: Schema): Promise<Diff[]> {
if (err.status !== 400) {
throw err;
}
// Display failed precondition errors nicely.
const invalidConnectors = errors.getInvalidConnectors(err);
const incompatible = errors.getIncompatibleSchemaError(err);
if (!incompatible && !invalidConnectors.length) {
// If we got a different type of error, throw it
throw err;
}

// Display failed precondition errors nicely.
if (invalidConnectors.length) {
displayInvalidConnectors(invalidConnectors);
}
const incompatible = errors.getIncompatibleSchemaError(err);
if (incompatible) {
displaySchemaChanges(incompatible);
return incompatible.diffs;
}
if (!incompatible && !invalidConnectors.length) {
// If we got a different type of error, throw it
throw err;
}
}
return [];
}
Expand Down Expand Up @@ -75,6 +76,7 @@ export async function migrateSchema(args: {
// If we got a different type of error, throw it
throw err;
}

const shouldDeleteInvalidConnectors = await promptForInvalidConnectorError(
options,
invalidConnectors,
Expand Down

0 comments on commit 7d7a65c

Please sign in to comment.