Fix error message when saving an empty usercss. Closes #795

This commit is contained in:
Rob Garrison 2019-11-02 10:28:25 -05:00
parent c0fd71dda6
commit a01645daf0
2 changed files with 7 additions and 0 deletions

View File

@ -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"

View File

@ -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;