Skip to content

Commit 3ee1a31

Browse files
Merge pull request #169 from HubSpot/br-remove-custom-project-403-errors
Remove custom project 403 error handlers
2 parents e495bd1 + 6a73fe2 commit 3ee1a31

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

errors/apiErrors.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ export function getAxiosErrorWithContext(
130130
): Error {
131131
const status = error.response?.status;
132132
const method = error.config?.method as HttpMethod;
133-
const { projectName } = context;
134133

135134
let messageDetail: string;
136135

@@ -161,9 +160,6 @@ export function getAxiosErrorWithContext(
161160
i18n(`${i18nKey}.unableToUpload`, { payload: context.payload })
162161
);
163162
}
164-
const isProjectMissingScopeError =
165-
isMissingScopeError(error) && !!projectName;
166-
const isProjectGatingError = isGatingError(error) && !!projectName;
167163

168164
switch (status) {
169165
case 400:
@@ -173,21 +169,7 @@ export function getAxiosErrorWithContext(
173169
errorMessage.push(i18n(`${i18nKey}.codes.401`, { messageDetail }));
174170
break;
175171
case 403:
176-
if (isProjectMissingScopeError) {
177-
errorMessage.push(
178-
i18n(`${i18nKey}.codes.403ProjectMissingScope`, {
179-
accountId: context.accountId || '',
180-
})
181-
);
182-
} else if (isProjectGatingError) {
183-
errorMessage.push(
184-
i18n(`${i18nKey}.codes.403ProjectGating`, {
185-
accountId: context.accountId || '',
186-
})
187-
);
188-
} else {
189-
errorMessage.push(i18n(`${i18nKey}.codes.403`, { messageDetail }));
190-
}
172+
errorMessage.push(i18n(`${i18nKey}.codes.403`, { messageDetail }));
191173
break;
192174
case 404:
193175
errorMessage.push(i18n(`${i18nKey}.codes.404`, { messageDetail }));
@@ -216,7 +198,7 @@ export function getAxiosErrorWithContext(
216198
if (error?.response?.data) {
217199
const { message, errors } = error.response.data;
218200

219-
if (message && !isProjectMissingScopeError && !isProjectGatingError) {
201+
if (message) {
220202
errorMessage.push(message);
221203
}
222204

lang/en.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,6 @@
379379
"404": "The {{ messageDetail }} was not found.",
380380
"429": "The {{ messageDetail }} surpassed the rate limit. Retry in one minute.",
381381
"503": "The {{ messageDetail }} could not be handled at this time. Please try again or visit https://help.hubspot.com/ to submit a ticket or contact HubSpot Support if the issue persists.",
382-
"403ProjectMissingScope": "Couldn't run the project command because there are scopes missing in your production account. To update scopes, deactivate your current personal access key for {{ accountId }}, and generate a new one. Then run `hs auth` to update the CLI with the new key.",
383-
"403ProjectGating": "The current target account {{ accountId }} does not have access to HubSpot projects. To opt in to the CRM Development Beta and use projects, visit https://app.hubspot.com/l/product-updates/in-beta?update=13899236.",
384382
"500Generic": "The {{ messageDetail }} failed due to a server error. Please try again or visit https://help.hubspot.com/ to submit a ticket or contact HubSpot Support if the issue persists.",
385383
"400Generic": "The {{ messageDetail }} failed due to a client error.",
386384
"generic": "The {{ messageDetail }} failed."

types/Error.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export type AxiosErrorContext = {
3434
accountId?: number;
3535
request?: string;
3636
payload?: string;
37-
projectName?: string;
3837
};
3938

4039
export type OptionalError = BaseError | null | undefined;

0 commit comments

Comments
 (0)