Skip to content

Commit aac79f0

Browse files
authored
fix: Fix next branch (#194)
1 parent 27e725b commit aac79f0

File tree

4 files changed

+4
-30
lines changed

4 files changed

+4
-30
lines changed

api/__tests__/projects.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('../../http');
22
jest.mock('fs');
33
import { createReadStream } from 'fs';
4-
import http from '../../http';
4+
import { http } from '../../http';
55
import {
66
cancelStagedBuild,
77
checkCloneStatus,

lib/trackUsage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export async function trackUsage(
4545
if (accountConfig && accountConfig.authType === 'personalaccesskey') {
4646
logger.debug(i18n(`${i18nKey}.sendingEventAuthenticated`));
4747
try {
48-
const result: void = await http.post(accountId, {
48+
await http.post(accountId, {
4949
url: `${path}/authenticated`,
5050
data: usageEvent,
5151
resolveWithFullResponse: true,
5252
});
53-
return result;
53+
return;
5454
} catch (e) {
5555
logger.debug(i18n(`${i18nKey}.retryingEventUnauthenticated`));
5656
}

models/HubSpotHttpError.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { isAxiosError, AxiosError } from 'axios';
2-
import { isGatingError, isMissingScopeError } from '../errors';
32
import { HubSpotHttpErrorContext, ValidationError } from '../types/Error';
43
import { HttpMethod } from '../types/Api';
54
import { HTTP_METHOD_PREPOSITIONS, HTTP_METHOD_VERBS } from '../constants/api';
@@ -170,7 +169,6 @@ export class HubSpotHttpError<T = any> extends Error {
170169
const i18nKey = 'errors.apiErrors';
171170
const status = error.response?.status;
172171
const method = error.config?.method as HttpMethod;
173-
const { projectName } = context;
174172

175173
let messageDetail: string;
176174

@@ -201,9 +199,6 @@ export class HubSpotHttpError<T = any> extends Error {
201199
i18n(`${i18nKey}.unableToUpload`, { payload: context.payload })
202200
);
203201
}
204-
const isProjectMissingScopeError =
205-
isMissingScopeError(error) && !!projectName;
206-
const isProjectGatingError = isGatingError(error) && !!projectName;
207202

208203
switch (status) {
209204
case 400:
@@ -213,22 +208,6 @@ export class HubSpotHttpError<T = any> extends Error {
213208
errorMessage.push(i18n(`${i18nKey}.codes.401`, { messageDetail }));
214209
break;
215210
case 403:
216-
// TODO: Move projects specific errors to CLI in follow up
217-
if (isProjectMissingScopeError) {
218-
errorMessage.push(
219-
i18n(`${i18nKey}.codes.403ProjectMissingScope`, {
220-
accountId: context.accountId || '',
221-
})
222-
);
223-
} else if (isProjectGatingError) {
224-
errorMessage.push(
225-
i18n(`${i18nKey}.codes.403ProjectGating`, {
226-
accountId: context.accountId || '',
227-
})
228-
);
229-
} else {
230-
errorMessage.push(i18n(`${i18nKey}.codes.403`, { messageDetail }));
231-
}
232211
break;
233212
case 404:
234213
errorMessage.push(i18n(`${i18nKey}.codes.404`, { messageDetail }));
@@ -259,7 +238,7 @@ export class HubSpotHttpError<T = any> extends Error {
259238
if (error?.response?.data) {
260239
const { message, errors } = error.response.data;
261240

262-
if (message && !isProjectMissingScopeError && !isProjectGatingError) {
241+
if (message) {
263242
errorMessage.push(message);
264243
}
265244

models/__tests__/HubSpotHttpError.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,6 @@ describe('models/HubSpotHttpError', () => {
337337
message: 'The request was unauthorized.',
338338
name: 'generates a 401 api status code error',
339339
},
340-
{
341-
status: 403,
342-
message: 'The request was forbidden.',
343-
name: 'generates a 403 api status code error',
344-
},
345340
{
346341
status: 404,
347342
message: 'The request was not found.',

0 commit comments

Comments
 (0)