Skip to content

fix: typecheck issue#269

Merged
shivammittal274 merged 1 commit intomainfrom
fix/typecheck-issue
Jan 22, 2026
Merged

fix: typecheck issue#269
shivammittal274 merged 1 commit intomainfrom
fix/typecheck-issue

Conversation

@shivammittal274
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the fix label Jan 22, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 22, 2026

Greptile Summary

Fixed TypeScript type errors in error handling by adding proper type guards and string conversions for logger.error() calls.

  • Added err instanceof Error check in closePage handler before accessing err.message
  • Fixed logger.error() calls in handleDialog to convert errors to strings (logger expects string as first parameter)

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - fixes type errors without changing behavior
  • The changes correctly fix TypeScript type errors by adding proper type guards. The fixes are minimal and don't alter runtime behavior. Minor suggestion: preserve full error objects as metadata instead of converting to strings.
  • No files require special attention

Important Files Changed

Filename Overview
apps/server/src/tools/cdp-based/pages.ts Added type guards for error handling to fix TypeScript issues with logger.error() calls

Sequence Diagram

sequenceDiagram
    participant Client as MCP Client
    participant Handler as Tool Handler
    participant Logger as Logger
    participant CDP as Chrome DevTools Protocol

    alt closePage error handling
        Client->>Handler: closePage(pageIdx)
        Handler->>CDP: closePage(pageIdx)
        CDP-->>Handler: throws error
        Handler->>Handler: if (err instanceof Error && err.message === ERRORS.CLOSE_PAGE)
        Handler->>Logger: (error handled in response)
        Handler-->>Client: return response with error message
    end

    alt handleDialog error handling  
        Client->>Handler: handleDialog(action)
        Handler->>CDP: dialog.accept() or dialog.dismiss()
        CDP-->>Handler: throws error (already handled)
        Handler->>Handler: err instanceof Error ? err.message : String(err)
        Handler->>Logger: error(stringified error)
        Handler-->>Client: return success response
    end
Loading

@claude
Copy link

claude bot commented Jan 22, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@shivammittal274 shivammittal274 merged commit cfbb99f into main Jan 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant