Skip to content

Logging reference

src/utils/logging.ts exports the plugin's two logging entry points. Every catch block that previously called Zotero.debug directly calls one of these instead. See logging-explanation.md for why the split exists and how it was confirmed.

logFailure(message: string, err?: unknown): void

For a genuine failure - one worth being able to find after the fact, without debug logging having been on when it happened.

Calls Zotero.logError(new Error(...)), which reaches both Zotero.debug (gated on debug logging) and the Mozilla error console via Zotero.getErrors() (not gated on anything).

message should already carry the [zoteroLinkedMindmaps] prefix and any relevant detail, matching the convention at every call site. err, when given, supplies the stack: err.stack if err is an Error, otherwise a stack captured at the logFailure call site itself. The stack is appended to message with a newline before the combined string becomes the new Error's message - Zotero.logError only forwards err.message to the error console, not err.stack, so a stack left on the Error object alone would not survive to that channel.

logTrace(message: string, level?: number): void

For an expected-and-handled condition: something the code already accounts for, not a bug report a user would need to be locatable. A thin wrapper over Zotero.debug(message, level) - visible only while debug logging is already enabled.

Severity by call site

FileWhat's loggedLevel
addLinkForm.ts (both save-link catches)link save failedfailure
connectionsPanel.ts (unregister no-op)section was never registeredtrace
connectionsPanel.ts (add-link form load)failed to load mindmap documentfailure
connectionsPanel.ts (findMindmapForItem)unreadable storage note, skippedfailure
connectionsPanel.ts (renderPanelBody)failed to read mindmap documentfailure
connectionsPanel.ts (applyToMindmap)failed to apply a panel changefailure
containerGuard.ts (reconcileContainers)container reconciliation failedfailure
containerGuard.ts (trash notify)container trash check failedfailure
deletionCleanup.ts (pruneLibrary, StorageError)mindmap vanished/stopped parsing between listing and update - anticipated race, cleanup continuestrace
deletionCleanup.ts (notify)deletion cleanup failedfailure
graphRenderer.ts (node drag)persisting dragged node positions failedfailure
graphRenderer.ts (grouping apply)grouping change failedfailure
graphRenderer.ts (live refresh)mindmap live refresh failedfailure
libraryContextMenu.ts (mindmapsForPopup)could not list mindmaps for the item menufailure
libraryFilter.ts (registerLibraryFilter guard)no getSearchObject to patch, container stays visiblefailure
libraryFilter.ts (getSearchObject wrap)hiding the plugin container failedfailure
linkTypes.ts (getLinkTypes, typeof raw !== "string")pref never set - expected on every fresh profilenone (silent by design)
linkTypes.ts (getLinkTypes, JSON.parse)link-types pref would not parse, falling back to defaultsfailure
linkTypes.ts (getLinkTypes, shape check)link-types pref has an unexpected shape, falling back to defaultsfailure
mindmapTab.ts (handleSave)mindmap save failedfailure
mindmapTab.ts (handleDelete)mindmap delete failedfailure
storage.ts (findMindmapById)unreadable storage note, skipped while resolving an idfailure
storage.ts (readAllMindmaps)unreadable storage note, skipped while listingfailure

The two deletionCleanup.ts and connectionsPanel.ts (unregister) trace-level sites are the only call sites in the plugin that stayed at trace after this pass: each catches a condition its own comment already documents as expected, not a failure a bug report would need surfaced.

consolePolyfill routing

src/utils/consolePolyfill.ts maps the shimmed console object's five logging-adjacent members onto these two functions:

console.* memberRoutes to
log, group, groupCollapsedlogTrace
warnlogTrace(..., 2)
errorlogFailure

groupEnd and trace remain no-ops. See polyfills-reference.md for the rest of the shim (why it exists, when it must load).

See also

  • logging-explanation.md for the probe finding this design is based on.
  • .github/ISSUE_TEMPLATE/bug_report.yml for the reporter-facing instructions this enables.

Released under the AGPL-3.0-or-later license.