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

2822 gitlab sync is not allowing users to push tokens #2854

Merged

Conversation

robinhoodie0823
Copy link
Contributor

Why does this PR exist?

Current plugin has no feature to let the users know if there is an error during pushing tokens to remote provider.

Closes #2822

What does this pull request do?

Added a feature, so show message to users if there is an error during pushing tokens to remote providers.

Testing this change

Additional Notes (if any)

20240614_032237.mp4

Copy link

changeset-bot bot commented Jun 14, 2024

⚠️ No Changeset found

Latest commit: 5e19e1e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@robinhoodie0823 robinhoodie0823 requested a review from six7 June 14, 2024 07:24
@@ -101,7 +101,7 @@ export function useGitLab() {
themes,
metadata: {},
};
} catch (e) {
} catch (e: any) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (e: any) {
} catch (e: Error) {

This would save checking e instanceof Error below, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. The error type Gitbeaker module returns is not Error.
So it need to be flexible.

break;
}
default:
throw new Error('Not implemented');
}
if (pushResult.status && String(pushResult.status).includes('failure')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the status need to be cast to a string? Is it not always status: 'failure' or status: 'success'? Then it should work.

Suggested change
if (pushResult.status && String(pushResult.status).includes('failure')) {
if (pushResult.status && pushResult.status === 'failure')) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

break;
}
default:
throw new Error('Not implemented');
}
if (pushResult.status && String(pushResult.status).includes('failure')) {
notifyToUI(String(pushResult.errorMessage), { error: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar question, in what cases are the errorMessages not a string? We should be handling these to being strings before throwing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor

Choose a reason for hiding this comment

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

These messages should be translated and offer an extensive list. Created a ticket: #2856

@six7 six7 merged commit f38aa4d into release-139 Jun 15, 2024
7 of 8 checks passed
@six7 six7 deleted the 2822-gitlab-sync-is-not-allowing-users-to-push-tokens branch June 15, 2024 09:25
@six7 six7 linked an issue Jun 15, 2024 that may be closed by this pull request
@six7 six7 added the 2.0-rc8 label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gitlab Sync is Not Allowing Users To Push Tokens
3 participants