Skip to content

v0.1.0-alpha.2.1

Pre-release
Pre-release

Choose a tag to compare

@devharshthakur devharshthakur released this 30 Mar 13:54
· 8 commits to main since this release

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