Skip to content

Commit d617a10

Browse files
authored
Merge pull request #18 from axa-group/poveden/parse-error-message
Poveden/parse error message
2 parents 0daa279 + 00ef0b2 commit d617a10

File tree

5 files changed

+57
-50
lines changed

5 files changed

+57
-50
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

7+
## [1.1.4](https://github.com/axa-group/arm-template-merge/compare/v1.1.3...v1.1.4) — 2019-10-10
8+
9+
### Security
10+
11+
- Update `npm` dependencies to fix:
12+
- [WS-2019-0291](https://github.com/wycats/handlebars.js/issues/1558)
13+
14+
### Added
15+
16+
- Improve error message on template parsing failures
17+
718
## [1.1.3](https://github.com/axa-group/arm-template-merge/compare/v1.1.2...v1.1.3) — 2019-09-25
819

920
### Security

bin/arm-template-merge

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ async function loadTemplate(inFile) {
134134
}
135135

136136
const json = jsonBuf.toString('utf8');
137-
const template = JSON.parse(json);
137+
138+
let template;
139+
try {
140+
template = JSON.parse(json);
141+
} catch (err) {
142+
throw new Error(`Template '${inFile}' could not be parsed: ${err.message}`);
143+
}
138144

139145
const expectedKeys = ['$schema', 'contentVersion'];
140146

package-lock.json

Lines changed: 35 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arm-template-merge",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "Azure Resource Manager (ARM) Template Merge",
55
"keywords": [
66
"azure",
@@ -41,10 +41,10 @@
4141
"test": "npm run jest"
4242
},
4343
"dependencies": {
44-
"fast-glob": "^3.0.4"
44+
"fast-glob": "^3.1.0"
4545
},
4646
"devDependencies": {
47-
"eslint": "^6.4.0",
47+
"eslint": "^6.5.1",
4848
"eslint-config-airbnb-base": "^14.0.0",
4949
"eslint-plugin-import": "^2.18.2",
5050
"eslint-plugin-jest": "^22.17.0",

test/cli.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('CLI', () => {
5454
rfn.mockRestore();
5555

5656
expect(res.exitCode).toBe(1);
57-
expect(res.stderr).toMatch(/^Error:/);
57+
expect(res.stderr).toMatch(/^Error: Template 'templates\/website.json' could not be parsed:/);
5858
});
5959

6060
it('should be able to merge template files into a new file', async () => {

0 commit comments

Comments
 (0)