11import { isAxiosError , AxiosError } from 'axios' ;
2- import { isGatingError , isMissingScopeError } from '../errors' ;
32import { HubSpotHttpErrorContext , ValidationError } from '../types/Error' ;
43import { HttpMethod } from '../types/Api' ;
54import { 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
0 commit comments