Skip to content

ApiUnavailableError and ApiRequestError never set name, so both report as "Error" in logs and error reporting #867

Closed

Description

@chonilius

src/lib/api.ts:18-29:

export class ApiUnavailableError extends Error {}

export class ApiRequestError extends Error {
  constructor(message: string, public status: number, public retryAfter?: number, public code?: string) {
    super(message);
  }
}

Neither assigns this.name. src/lib/env.ts:19-23 gets this right (this.name = "EnvValidationError"), so the codebase already has the pattern.

Why it matters: err.name is what appears in console.error output, in a stack trace's first line, and in the grouping key most error-reporting services use. Every API failure therefore logs as a generic Error, and the distinction between "backend unreachable, mock data served" and "backend rejected this action" — the distinction these two classes exist to draw — is invisible in logs. instanceof still works in-process, but is unavailable to anything reading serialized output.

Fix: set this.name in both constructors. Also set it on any future subclass; a short comment in env.ts's style keeps the convention visible.

Activity

  1. Lion4467cat commented on Nov 14, 2026

    @Lion4467cat

    Hi @chonilius, I have implemented the fix and unit tests for this issue in PR #954. Kindly assign this issue to me and review #954 when convenient. Thank you!

  2. added a commit that references this issue on Nov 14, 2026
    f1cb095
  3. Temibell commented on Nov 18, 2026

    @Temibell

    @Temibell has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

    Hi Maintainer, I can fix this pls assign. ETA 5hrs

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Temibell to this issue.

  4. choniszn1 commented on Nov 18, 2026

    @choniszn1

    @choniszn1 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

    Hello maintainer,I’d love to work on this issue please,I promise to do a good job

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @choniszn1 to this issue.

  5. drips-wave commented on Nov 18, 2026

    @drips-wave

    Congratulations, @choniszn1! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

    🧑‍💻 @choniszn1: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. drips-wave commented on Nov 18, 2026

    @drips-wave

    This issue has been completed by @choniszn1 as part of the Stellar Wave Program's 11th Wave 🥳

    😎 @choniszn1: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions