Skip to content
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

Retrieve and refresh integration insight on demand #499

Merged
merged 6 commits into from
Jan 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
handle not implemented error
  • Loading branch information
etsai2-stripe committed Jan 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b6d78e4531dddb8c33ffe5e5fadc73131edfaeac
10 changes: 9 additions & 1 deletion src/stripeWorkspaceState.ts
Original file line number Diff line number Diff line change
@@ -112,7 +112,15 @@ async function getIntegrationInsight(logId: string, daemonClient: StripeCLIClien
const integrationInsight = await new Promise<string>((resolve, reject) => {
daemonClient.integrationInsight(request, (error: any, response: any) => {
if (error) {
resolve(`(Failed to retrieve insight: ${error})`);
if (error.code === 12) {
// https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// 12: UNIMPLEMENTED
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the grpc library should have these error codes built in as constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will use the grpc constants

vscode.window.showErrorMessage(
'Please upgrade your Stripe CLI to the latest version to retrieve integration insight.',
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're not resolving the promise in this case. Would this cause the log to load indefinitely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

} else {
resolve(`(Failed to retrieve insight: ${error})`);
}
} else if (response) {
const insight = response.getMessage();
if (insight === 'log not found') {