Improve error handling
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 1m40s

This commit is contained in:
MassiveBox 2025-07-16 15:57:14 +02:00
parent 05984a8913
commit eaf4a8e39e
7 changed files with 109 additions and 45 deletions

View file

@ -1,8 +1,9 @@
import {PluginFile} from "@/file";
import {CONFIG_FILENAME, JSON_MIME, STORAGE_PATH} from "@/const";
import {Plugin, showMessage} from "siyuan";
import {Plugin} from "siyuan";
import {SettingUtils} from "@/libs/setting-utils";
import {getFirstDefined} from "@/helper";
import {ErrorReporter, InvalidBackgroundColorError} from "@/errors";
export interface Options {
dialogOnDesktop: boolean
@ -90,7 +91,7 @@ export class PluginConfigViewer {
let color = data.backgroundDropdown === "CUSTOM" ? data.background : data.backgroundDropdown;
if(!PluginConfig.validateColor(color)) {
showMessage(this.plugin.i18n.errInvalidBackgroundColor, 0, 'error');
ErrorReporter.error(new InvalidBackgroundColorError());
data.background = this.config.options.editorOptions.background;
this.settingUtils.set('background', data.background);
}