All files / src/web reporting.js

100% Statements 9/9
100% Branches 4/4
100% Functions 4/4
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22    34x     14x 14x       13x 2x             1x 1x    
import { toast } from "./toast.js";
 
export const errorText = (error) => error?.message ?? `${error}`;
 
export function reportLoadFailure(description, error) {
    console.error(`Error loading ${description}:`, error);
    toast(`Could not load ${description}: ${errorText(error)}`, { title: "Loading" });
}
 
export function reportIgnoredFiles(name, ignored) {
    if (!ignored.length) return;
    toast(`Loaded ${name}. The archive also holds ${ignored.join(", ")}, and only one file is loaded from it.`, {
        title: "Archive",
    });
}
 
/** Handles a component's "notice" event by toasting it. */
export function showNotice(event) {
    const { message, title, quietKey } = event.detail;
    toast(message, { title, quietKey });
}