Comfy-Org / Comfy-Org/ComfyUI_frontend

Audit: Improve actionability of console.error and custom Error messages across codebase

Open
#11,426 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Overview

Many `console.error` calls and custom `Error` objects throughout the codebase emit messages that lack sufficient context to be actionable in observability platforms such as Sentry. When an error appears in production logs, it should communicate:

1. **What happened** — a clear, specific description of the failure.
2. **Why it might be happening** — likely root causes or preconditions.
3. **What it means** — downstream impact or affected subsystem.
4. **What to do about it** — remediation steps or pointers to relevant code/docs.

Without this context, errors become noise rather than signal.

## Motivation

Identified during review of PR #11420, specifically the message:

```ts
console.error('[CanvasScheduler] op failed:', err)
```

This message tells us an operation failed inside the scheduler but does not indicate which operation, what canvas state was present, whether the queue was drained, or how to reproduce/diagnose the issue. See the original review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11420#discussion_r3107578483

## Scope of Audit

Perform a repo-wide scan for:

- `console.error(...)` calls with terse or opaque messages (e.g., single-word prefixes, bare variable dumps).
- `new Error('...')` or `throw` statements with messages that omit context about the subsystem, inputs, or expected vs. actual state.
- Error handlers in `catch` blocks that swallow or minimally log errors.

Focus areas (non-exhaustive):
- `src/scripts/`
- `src/composables/`
- `src/stores/`
- `src/lib/litegraph/`
- `src/renderer/`

## Acceptance Criteria

- Each identified error message is updated to include: subsystem/module name, description of the failed operation, relevant runtime values (e.g., op name, canvas state, queue length), and guidance on likely causes.
- New error messages are consistent with a structured format (e.g., `[Module] Action failed — reason: . State: .`).
- No regressions in existing tests.

## References

- Originating PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11420
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11420#discussion_r3107578483
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11426-Audit-Improve-actionability-of-console-error-and-custom-Error-messages-across-codeba-3476d73d365081fa9be0d4d622353a83) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.