File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,15 +105,26 @@ module.exports = {
105105 stackLatestError . ResourceStatusReason || stackLatestError . ResourceStatus
106106 } .`;
107107 const errorCode = ( ( ) => {
108- if (
109- stackLatestError . ResourceStatusReason &&
110- stackLatestError . ResourceStatusReason . startsWith ( 'Properties validation failed' )
111- ) {
112- return `AWS_STACK_${ action . toUpperCase ( ) } _VALIDATION_ERROR` ;
108+ if ( stackLatestError . ResourceStatusReason ) {
109+ if (
110+ stackLatestError . ResourceStatusReason . startsWith (
111+ 'Properties validation failed'
112+ )
113+ ) {
114+ return `AWS_CLOUD_FORMATION_${ action . toUpperCase ( ) } _STACK_INTERNAL_VALIDATION_ERROR` ;
115+ }
116+ if (
117+ stackLatestError . ResourceStatusReason . includes ( 'is not authorized to perform' )
118+ ) {
119+ return `AWS_CLOUD_FORMATION_${ action . toUpperCase ( ) } _STACK_INTERNAL_INSUFFICIENT_PERMISSIONS` ;
120+ }
113121 }
114- return `AWS_STACK_${ action . toUpperCase ( ) } ${ resourceTypeToErrorCodePostfix (
115- stackLatestError . ResourceType
116- ) } _${ stackLatestError . ResourceStatus } `;
122+ return (
123+ `AWS_CLOUD_FORMATION_${ action . toUpperCase ( ) } _STACK_INTERNAL` +
124+ `${ resourceTypeToErrorCodePostfix ( stackLatestError . ResourceType ) } _${
125+ stackLatestError . ResourceStatus
126+ } `
127+ ) ;
117128 } ) ( ) ;
118129 throw new ServerlessError ( errorMessage , errorCode ) ;
119130 }
You can’t perform that action at this time.
0 commit comments