Skip to content

Commit

Permalink
refactor(AWS Deploy): Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 7, 2021
1 parent 02be86c commit d071c5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/plugins/aws/package/lib/mergeCustomProviderResources.js
Expand Up @@ -72,7 +72,8 @@ module.exports = {
// default includes any future attributes we don't know about yet.
default:
throw new ServerlessError(
`${resourceName}: Sorry, extending the ${extensionAttributeName} resource ` +
`Cannot extend "${resourceName}" resource, as extending ` +
`the "${extensionAttributeName}" ` +
'attribute at this point is not supported. Feel free to propose support ' +
'for it in the Framework issue tracker: ' +
'https://github.com/serverless/serverless/issues',
Expand Down
Expand Up @@ -4,6 +4,7 @@ const path = require('path');
const expect = require('chai').expect;
const AwsPackage = require('../../../../../../../lib/plugins/aws/package/index');
const Serverless = require('../../../../../../../lib/Serverless');
const ServerlessError = require('../../../../../../../lib/serverless-error');

describe('mergeCustomProviderResources', () => {
let serverless;
Expand Down Expand Up @@ -299,9 +300,9 @@ describe('mergeCustomProviderResources', () => {
},
};

expect(() => awsPackage.mergeCustomProviderResources()).to.throw(
/SampleResource: Sorry, extending the unsupported resource attribute at this point is not supported/
);
expect(() => awsPackage.mergeCustomProviderResources())
.to.throw(ServerlessError)
.with.property('code', 'RESOURCE_EXTENSION_UNSUPPORTED_ATTRIBUTE');
});
});
});

0 comments on commit d071c5f

Please sign in to comment.