Skip to content

Missing documentation for Try utility in README #398

@orionnye

Description

@orionnye

The README imports and uses the Try function in the example code:
README.md

Lines 75-75
import { describe, Try } from 'riteway/index.js';

Lines 110-112
actual: Try(sum, 1, NaN),expected: new TypeError('NaN')

However, there's no documentation section explaining:
What the Try function does
When to use it (appears to be for testing exceptions/throws)
Its API signature and parameters
How it compares the actual error to the expected error
The README has thorough API documentation for describe, assert, render, match, and countKeys, but Try is missing from the API section despite being a core utility for testing error cases.
Suggested Fix:
Add a section to the API documentation (after the countKeys section) that describes:

TryGiven a function and arguments, return the error thrown or undefined if no error was thrown. Used for testing exception cases in your assertions.

This would help developers understand how to properly test error-throwing functions with Riteway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions