Skip to content

Commit

Permalink
Merge pull request #18 from axa-group/poveden/parse-error-message
Browse files Browse the repository at this point in the history
Poveden/parse error message
  • Loading branch information
poveden committed Oct 10, 2019
2 parents 0daa279 + 00ef0b2 commit d617a10
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 50 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

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

## [1.1.4](https://github.com/axa-group/arm-template-merge/compare/v1.1.3...v1.1.4) — 2019-10-10

### Security

- Update `npm` dependencies to fix:
- [WS-2019-0291](https://github.com/wycats/handlebars.js/issues/1558)

### Added

- Improve error message on template parsing failures

## [1.1.3](https://github.com/axa-group/arm-template-merge/compare/v1.1.2...v1.1.3) — 2019-09-25

### Security
Expand Down
8 changes: 7 additions & 1 deletion bin/arm-template-merge
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ async function loadTemplate(inFile) {
}

const json = jsonBuf.toString('utf8');
const template = JSON.parse(json);

let template;
try {
template = JSON.parse(json);
} catch (err) {
throw new Error(`Template '${inFile}' could not be parsed: ${err.message}`);
}

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

Expand Down
80 changes: 35 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arm-template-merge",
"version": "1.1.3",
"version": "1.1.4",
"description": "Azure Resource Manager (ARM) Template Merge",
"keywords": [
"azure",
Expand Down Expand Up @@ -41,10 +41,10 @@
"test": "npm run jest"
},
"dependencies": {
"fast-glob": "^3.0.4"
"fast-glob": "^3.1.0"
},
"devDependencies": {
"eslint": "^6.4.0",
"eslint": "^6.5.1",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
Expand Down
2 changes: 1 addition & 1 deletion test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('CLI', () => {
rfn.mockRestore();

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

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

0 comments on commit d617a10

Please sign in to comment.