menu_book Navigation menu

Notifications & Logging

UI Popups

Pragma CMS uses a centralized popup system to provide feedback to the user without interrupting their workflow.

displaySuccessPopup()

Displays a temporary green toast notification at the bottom of the screen. Old popups are automatically cleared to prevent stacking.

Signature:

JAVASCRIPT
function displaySuccessPopup(message, targetElement = null)

displayErrorPopup()

Displays a detailed error modal.

Feature: If the error message contains HTML <pre> tags (often generated by server-side exceptions), the popup automatically appends a "Copy" button to allow developers to easily copy the stack trace.

Signature:

JAVASCRIPT
function displayErrorPopup(message, autoCloseDuration = 0)

Example:

JAVASCRIPT
displayErrorPopup("Invalid Database Connection.", 5000); // Closes automatically after 5s

The Global Logger (pushLogEntry)

The Admin Panel includes a hidden "Log Panel" (accessible via the alert icon in the top right). Developers can push messages to this panel for silent debugging.

Signature:

JAVASCRIPT
function pushLogEntry(message, level)
// Levels: "success", "error", "warning", "info"

Automatic Error Capture (IIFE)

Pragma CMS automatically captures unhandled JavaScript errors and pushes them to the Log Panel. You do not need to configure this; it runs globally:

  1. window.onerror: Captures native syntax and runtime errors, logging the exact file and line number.
  2. unhandledrejection: Captures failed Async/Await Promises.
  3. console.error Hook: Intercepts console.error(), logs the message to the panel, and automatically runs console.trace() in the DevTools to provide a complete stack trace of who called the error.