diff --git a/lib/browser/api/menu-item.js b/lib/browser/api/menu-item.js index 25d52f8fbdb1..b8057922cb42 100644 --- a/lib/browser/api/menu-item.js +++ b/lib/browser/api/menu-item.js @@ -70,7 +70,7 @@ const MenuItem = function (options) { this.overrideProperty('checked', false) if (!MenuItem.types.includes(this.type)) { - throw new Error(`Unknown menu type ${this.type}`) + throw new Error(`Unknown menu item type: ${this.type}`) } this.commandId = ++nextCommandId diff --git a/spec/api-menu-spec.js b/spec/api-menu-spec.js index a8cc5b518cba..a9cf51189325 100644 --- a/spec/api-menu-spec.js +++ b/spec/api-menu-spec.js @@ -359,4 +359,17 @@ describe('menu module', function () { } }) }) + + describe('MenuItem with invalid type', function () { + it('throws an exception', function () { + assert.throws(function () { + var menu = Menu.buildFromTemplate([ + { + label: 'text', + type: 'not-a-type' + } + ]) + }, /Unknown menu item type: not-a-type/) + }) + }) })