-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy patheventually-report-resolution-errors.js
More file actions
32 lines (27 loc) · 972 Bytes
/
eventually-report-resolution-errors.js
File metadata and controls
32 lines (27 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const path = require('path');
const { log } = require('../../utils/serverless-utils/log');
const ServerlessError = require('../../serverless-error');
const resolveCliInput = require('../../cli/resolve-input');
module.exports = (configurationPath, configuration, variablesMeta) => {
const resolutionErrors = new Set(
Array.from(variablesMeta.values(), ({ error }) => error).filter(Boolean)
);
if (!resolutionErrors.size) return false;
if (resolveCliInput().isHelpRequest) {
log.warning(
'Resolution of service configuration failed when resolving variables: ' +
`${Array.from(resolutionErrors, (error) => `\n - ${error.message}`)}\n`
);
return true;
}
throw new ServerlessError(
`Cannot resolve ${path.basename(
configurationPath
)}: Variables resolution errored with:${Array.from(
resolutionErrors,
(error) => `\n - ${error.message}`
)}`,
'VARIABLES_RESOLUTION_ERROR'
);
};