Skip to content

Add Result and runCatching utilities#1

Merged
injoonH merged 3 commits into
mainfrom
feat/result-run-catching
Jul 27, 2025
Merged

Add Result and runCatching utilities#1
injoonH merged 3 commits into
mainfrom
feat/result-run-catching

Conversation

@injoonH

@injoonH injoonH commented Jul 27, 2025

Copy link
Copy Markdown
Owner

Features

  • Add Result class and runCatching() function.

@injoonH injoonH requested a review from Copilot July 27, 2025 09:35
@injoonH injoonH self-assigned this Jul 27, 2025
@injoonH injoonH added the enhancement New feature or request label Jul 27, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a TypeScript implementation of Result type and runCatching utility function, inspired by Kotlin's error handling patterns. The implementation provides a robust way to handle success and failure states without throwing exceptions.

  • Add Result<T> class for encapsulating success/failure outcomes
  • Add runCatching() function for safe execution with automatic error catching
  • Include comprehensive test coverage and API documentation

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/stdlib/common/Result.ts Core Result class implementation with methods for handling success/failure states
src/stdlib/common/runCatching.ts Utility function that wraps function execution in Result type
src/stdlib/common/Throwable.ts Type definition for throwable values
src/stdlib/common/index.ts Export statements for new Result utilities
src/stdlib/common/Result.spec.ts Comprehensive test suite for Result class methods
src/stdlib/common/runCatching.spec.ts Test coverage for runCatching function
docs/api/core/kotlin-stdlib/kotlin/-result.md API documentation for Result class
docs/api/core/kotlin-stdlib/kotlin/run-catching.md API documentation for runCatching function
docs/.vitepress/config.mts Navigation configuration updates for new documentation

Comment thread src/stdlib/common/Result.spec.ts Outdated
@injoonH injoonH merged commit 60258f1 into main Jul 27, 2025
@injoonH injoonH deleted the feat/result-run-catching branch July 27, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants