Class

Result

Result

The Result class provides an organized and simple way to return errors without having to wrap every request in Try Catches.

Members

# readonly data

Retrieve the internal data object.

View Source lib/result.js, line 69

# readonly error

Retrieve the internal error object.

View Source lib/result.js, line 81

boolean

# isError

Check the class type, if it has an error, or not

View Source lib/result.js, line 61

Methods

# static failed(error) → {Result}

The static function to create new Result objects with the failed error object.

Parameters:
Name Type Description
error Error | *

The error parameter could be of any of the primitive Javascript types, but you should mostly use an Error instance.

View Source lib/result.js, line 53

Result

# static ok(data) → {Result}

The static function to create new Result objects with the sucessfull data object.

Parameters:
Name Type Description
data *

View Source lib/result.js, line 43

Result