Skip to content

fix(browser): catch malformed URL TypeError and map to exit 5 VALIDATION_ERROR #276

Closed

Description

@sandman-sh

Bug Report

Problem

In src/lib/browser.ts, openInBrowser(url) calls new URL(url) without a try/catch block. When passed a malformed URL string (e.g., "not a url"), Node.js throws an un-guarded TypeError: Invalid URL, crashing the process with exit code 1 instead of returning a typed VALIDATION_ERROR (exit code 5).

Proposed Fix

Wrap new URL(url) in a try/catch block and throw localValidationError('url', 'must be a valid http(s) URL', undefined, 'field').

Activity

  1. sandman-sh commented on Jul 22, 2026

    @sandman-sh
    ContributorAuthor

    /assign

  2. added
    in-progress
    on Jul 22, 2026
  3. testsprite-hob commented on Jul 22, 2026

    @testsprite-hob

    Assigned to @sandman-sh. Thanks for taking this on. (1 more slot available.)

    Your open assigned issues (2/3):

  4. changed the title [-]fix(browser): catch malformed URL TypeError and map to exit 5 VALIDATION_ERROR[/-] [+][Hackathon] fix(browser): catch malformed URL TypeError and map to exit 5 VALIDATION_ERROR[/+] on Jul 24, 2026
  5. changed the title [-][Hackathon] fix(browser): catch malformed URL TypeError and map to exit 5 VALIDATION_ERROR[/-] [+]fix(browser): catch malformed URL TypeError and map to exit 5 VALIDATION_ERROR[/+] on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in-progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions