-
Notifications
You must be signed in to change notification settings - Fork 494
chore: update the DryRunService to improve error messages #4001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,15 +157,30 @@ export class DryRunService { | |
} | ||
|
||
// Priority for syncs and actions | ||
let foundInProviderConfigKey: string | undefined; | ||
for (const script of [...integration.syncs, ...integration.actions]) { | ||
if (script.name !== syncName) { | ||
continue; | ||
} | ||
if (scriptInfo) { | ||
console.log(chalk.red(`Multiple integrations contain a script named "${syncName}". Please use "--integration-id"`)); | ||
// TODO: Confirm: If exists another script with the same name in the same integration, it's a variant issue | ||
if (foundInProviderConfigKey === providerConfigKey) { | ||
console.log( | ||
chalk.red( | ||
`Multiple variants of script "${syncName}" found in integration "${providerConfigKey}". Please specify which variant to use with "--variant"` | ||
) | ||
); | ||
} else { | ||
console.log( | ||
chalk.red( | ||
`Script "${syncName}" exists in multiple integrations (${foundInProviderConfigKey}, ${providerConfigKey}). Please specify which integration to use with "--integration-id"` | ||
) | ||
); | ||
} | ||
return; | ||
} | ||
scriptInfo = script; | ||
foundInProviderConfigKey = providerConfigKey; | ||
providerConfigKey = integration.providerConfigKey; | ||
Comment on lines
182
to
184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [DataTypeCheck] There's a potential issue with the assignment of Consider storing the original value before reassigning: scriptInfo = script;
foundInProviderConfigKey = providerConfigKey;
providerConfigKey = integration.providerConfigKey; |
||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I follow the logic. I don't think you can detect if variants exist unless querying the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, wasn't too sure about this one.
if we cant distinguish between the two should it just be an update to the existing error message to include variant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I don't really understand what the problem is with variants. Based on the code above it looks like if a variant is not specified the CLI default to the base one so I am not sure I understand the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me dig into this further get what the root cause of this request was