chore: error handling
This commit is contained in:
parent
85b510b881
commit
669c7f3964
|
@ -19,8 +19,10 @@
|
|||
import { addSettingsListener, Settings } from "@api/Settings";
|
||||
import { Toasts } from "@webpack/common";
|
||||
|
||||
import { Logger } from "./Logger";
|
||||
import { compileUsercss } from "./themes/usercss/compiler";
|
||||
|
||||
const logger = new Logger("QuickCSS");
|
||||
|
||||
let style: HTMLStyleElement;
|
||||
let themesStyle: HTMLStyleElement;
|
||||
|
@ -66,7 +68,11 @@ async function initThemes() {
|
|||
|
||||
if (IS_WEB) {
|
||||
for (const theme of enabledThemes) {
|
||||
const themeData = await VencordNative.themes.getThemeData(theme);
|
||||
try {
|
||||
var themeData = await VencordNative.themes.getThemeData(theme);
|
||||
} catch (e) {
|
||||
logger.error("Failed to get theme data for", theme, e);
|
||||
}
|
||||
if (!themeData) continue;
|
||||
|
||||
const blob = new Blob([themeData], { type: "text/css" });
|
||||
|
|
|
@ -55,7 +55,11 @@ const preprocessors: { [preprocessor: string]: (text: string, vars: Record<strin
|
|||
};
|
||||
|
||||
export async function compileUsercss(fileName: string) {
|
||||
const themeData = await VencordNative.themes.getThemeData(fileName);
|
||||
try {
|
||||
var themeData = await VencordNative.themes.getThemeData(fileName);
|
||||
} catch (e) {
|
||||
UserCSSLogger.error("Failed to get theme data for", fileName, e);
|
||||
}
|
||||
if (!themeData) return null;
|
||||
|
||||
// UserCSS preprocessor order look like this:
|
||||
|
|
Loading…
Reference in a new issue