Skip to content

Releases: devharshthakur/trycatch-lib

v0.1.0-alpha.3.0

v0.1.0-alpha.3.0 Pre-release
Pre-release

Choose a tag to compare

@devharshthakur devharshthakur released this 26 May 07:10
e201c3a

📝 Release Notes

✅ What’s New

  • Added Tests
    Comprehensive tests have been introduced to ensure code reliability and stability.

❌ Removed

  • makeAsync Utility
    • The makeAsync functionality/feature has been completely removed from the package, simplifying the codebase.

🛠️ Improvements

  • Refined Documentation
    Documentation has been updated and improved for better clarity and usability. Docs folder is be removed, instead readme acts as docs

v0.1.0-alpha.2.1

v0.1.0-alpha.2.1 Pre-release
Pre-release

Choose a tag to compare

@devharshthakur devharshthakur released this 30 Mar 13:54

trycatch-lib: v0.1.0-alpha.2.1

🚀 Alpha Release: Incremental Updates 🧪

This release encompasses changes introduced subsequent to the initial v0.1.0-alpha.0 release, culminating in version v0.1.0-alpha.2.1.

⚠️ Important: Pre-Production Status ⚠️

This remains an alpha version intended for evaluation and feedback. The API is subject to modification, and its utilization in production environments is not recommended.

✨ Key Enhancements Since v0.1.0-alpha.0

  • Version Control: The package version has been incremented to 0.1.0-alpha.2.1 to reflect internal modifications and refinements.

  • Documentation Augmentation: The README.md file has undergone significant enhancement, incorporating comprehensive examples for improved clarity and usability:

    • Elucidated examples demonstrating the application of trycatch with both asynchronous (fetch) and synchronous (JSON.parse) functions.
    • Detailed examples illustrating the usage of the makeAsync utility and the requisite handling of the MakeAsyncError return type.
    • Expanded API reference section within the README.md, providing comprehensive specifications and type signatures for makeAsync and MakeAsyncError, alongside core trycatch components.
  • makeAsync Utility:

    • The makeAsync utility and its associated MakeAsyncError are now patched with new code to make it work as intended and explicitly documented and presented as an integral part of the library's API.
    • ⚠️ Caveat: Attention is drawn to the inherent limitations in the reliability of the runtime check employed by makeAsync for detecting pre-existing asynchronous function characteristics. This mechanism may exhibit inaccuracies within bundled or transpiled code contexts. Exercise caution during implementation.
    import { makeAsync, MakeAsyncError } from "trycatch-lib";
    
    function synchronousFunction(x: number): number {
      // Executes a synchronous operation
      return x * 2;
    }
    
    const newAsyncFunc = makeAsync(synchronousFunction);
    
    if (potentiallyAsyncFunc instanceof MakeAsyncError) {
      console.error("Failed to wrap:", potentiallyAsyncFunc.message);
    } else {
      (async () => {
        // Invokes the asynchronously adapted function
        const result = await potentiallyAsyncFunc(10);
        console.log(result); // Output: 20
      })();
    }

⬇️ Installation (Latest Alpha Release)

To evaluate the latest alpha version (v0.1.0-alpha.2.1 or via the @alpha tag):

# Using pnpm
pnpm add trycatch-lib@alpha

# Using npm
npm install trycatch-lib@alpha

# Using yarn
yarn add trycatch-lib@alpha

🛠️ Usage Guidelines

Refer to the README.md file for comprehensive usage examples and detailed API documentation.

📢 Feedback Solicitation

Your insights and feedback regarding these alpha versions are highly valued. Please report any identified issues or suggested enhancements via the GitHub repository. Your contributions are greatly appreciated.

Full Changelog: 0.1.0-alpha.0...0.1.0-alpha2.1

0.1.0-aplha.0

0.1.0-aplha.0 Pre-release
Pre-release

Choose a tag to compare

@devharshthakur devharshthakur released this 26 Mar 16:37

🚀 Release Preview: trycatch-lib v0.1.0-alpha.0 🧪

🚨 THIS IS AN ALPHA RELEASE INTENDED FOR EARLY TESTING AND FEEDBACK. NOT FOR PRODUCTION USE! 🚨

This document highlights the changes in the initial v0.1.0 alpha release of trycatch-lib, now available for early preview under the @alpha distribution tag on npm.

We encourage adventurous developers to test this version on simple typescript projects and provide feedback on the core functionality. 🛠️

⬇️ Installation

To install this specific preview version, use the @alpha tag with your package manager:

Using pnpm:

pnpm add trycatch-lib@alpha

Using npm:

npm install trycatch-lib@alpha

Using yarn:

yarn add trycatch-lib@alpha

(Replace @alpha with the actual tag used for publishing if you choose a different one.)

✨ Highlights & Changes in this Preview (v0.1.0-alpha.0)

This is the first alpha release of trycatch-lib. It lays the foundation for a try...catch-less error handling experience. 🚀 Key features include:

  • 📦 trycatch(fn) function: Wraps any function (sync or async) and returns a new function that always resolves to a [error, result] tuple.
  • 🔥 TryCatchError class: A custom error class for encapsulating the original error or thrown value, providing context and traceability.
  • ✅ isTryCatchError(error: unknown) function: A TypeScript type guard to safely determine if a value is a TryCatchError instance.
  • 🔗 TryCatchResultTuple<T> type: A type alias representing the consistent [error, result] tuple format.
  • 🚫 Eliminates try...catch boilerplate: Simplifies asynchronous JavaScript/TypeScript code by centralizing error handling into a predictable pattern.
  • ⚙️ Leverages modern module systems: Exports CommonJS and ES Module formats for wide compatibility. The exports field in package.json offers import flexibility.

⚠️ Known Issues

  • This is an early alpha release - expect API changes based on feedback. 🚧
  • Testing coverage is still limited at this stage. 🧪
  • Documentation is in progress. 📝
  • Users must test against and with a valid npmjs.com token. 🔑
  • The package.json may contain local file paths (link: dependencies) and should be replaced before publishing to npmjs.com. ⚠️

📢 Providing Feedback

Your feedback is super valuable to me! 💖 Please report any bugs, unexpected behavior, or suggestions by opening an issue on our GitHub repository:

https://github.com/yourusername/trycatch-lib/issues

When reporting issues, please include:

  • The preview version you are using (v0.1.0-alpha.0).
  • Your Node.js version and operating system.
  • Clear steps to reproduce the issue.
  • Any relevant code snippets.

🛑 Disclaimer

This alpha release is potentially unstable and may contain bugs. Features and APIs might change significantly before the final stable release. DO NOT USE THIS VERSION IN PRODUCTION ENVIRONMENTS. 🛑


🙏 Thank you for helping me build & test trycatch-lib! For documentation on the latest stable release (when it exists), please see the main README.md. 📚