Try
Library of error handling functions.
Functions
IsError
Checks whether a value is an error.
Syntax:
Try.IsError(value: anything)
Parameters
value
: The value to check.
Returns
bool
: True if the value is an error, false otherwise.
Example:
let x: string = "hi" in Try.IsError(x)
// Result:
// false
let x: int = Error.Build("failure!") in Try.IsError(x)
// Result:
// true
IsSuccess
Checks whether a value is success, i.e. not an error.
Syntax:
Try.IsSuccess(value: anything)
Parameters
value
: The value to check.
Returns
bool
: True if the value is valid, false if it is an error.
Example:
let x: string = "hi" in Try.IsSuccess(x) // true
// Result:
// true
let x: int = Error.Build("failure!") in Try.IsSuccess(x) // false
// Result:
// false