Skip to content

Standardize error handling with shared utility #417

@markvp

Description

@markvp

Problem

Three different error extraction patterns across the codebase:

  1. catch (err: any) + err.message
  2. catch (err) + err instanceof Error ? err.message : String(err)
  3. Raw catch (err) + logging err directly

Proposal

Create a shared getErrorMessage(err: unknown): string utility and use it consistently:

export function getErrorMessage(err: unknown): string {
    if (err instanceof Error) return err.message;
    return String(err);
}

Replace all ad-hoc error extraction with this utility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions