Problem
Three different error extraction patterns across the codebase:
catch (err: any) + err.message
catch (err) + err instanceof Error ? err.message : String(err)
- 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.
Problem
Three different error extraction patterns across the codebase:
catch (err: any)+err.messagecatch (err)+err instanceof Error ? err.message : String(err)catch (err)+ loggingerrdirectlyProposal
Create a shared
getErrorMessage(err: unknown): stringutility and use it consistently:Replace all ad-hoc error extraction with this utility.