Fix: check err.code

This commit is contained in:
eight 2018-09-26 10:37:14 +08:00
parent 1fe0586b29
commit 2abbf670d8

View File

@ -215,7 +215,7 @@ function createSourceEditor(style) {
})
.catch(err => {
if (err.handled) return;
if (err.message === t('styleMissingMeta', 'name')) {
if (err.code === 'missingMandatory' && err.args.includes('name')) {
messageBox.confirm(t('usercssReplaceTemplateConfirmation')).then(ok => ok &&
chromeSync.setLZValue('usercssTemplate', code)
.then(() => chromeSync.getLZValue('usercssTemplate'))