diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c8368fad..62b078c4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1161,6 +1161,10 @@ "message": "Restore removed section", "description": "Label for the button to restore a removed section" }, + "sectionEmpty": { + "message": "Not saved due to lack of usercss sections.\n\nAdd at least one @-moz-document domain(\"example.com\") {} section", + "description": "Error shown when the user tries to save an empty usercss style" + }, "shortcuts": { "message": "Shortcuts", "description": "Go to shortcut configuration" diff --git a/js/usercss.js b/js/usercss.js index 85937ec6..a0c68ca6 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -71,6 +71,9 @@ const usercss = (() => { .then(({sections, errors}) => { if (!errors.length) errors = false; if (!sections.length || errors && !allowErrors) { + if (!errors) { + errors = chrome.i18n.getMessage('sectionEmpty'); + } throw errors; } style.sections = sections;