The Try interface allow the parser to recover from a parse failure and try backtacking with another parser using for example `or()`. It accepts a value when success, or an error value when failed

### Type parameters

- #### V

- #### E

### Hierarchy

- Try

## Index

### Methods

- failure
- filter
- flatMap
- isFailure
- isSuccess
- lazyRecoverWith
- map
- onFailure
- onSuccess
- recoverWith
- success

## Methods

### failure

- failure(): E

- - Defined in masala-parser.d.ts:98

  Returns the failure value

  #### Returns E

### filter

- filter(predicate: function): Try<V, E>

- - Defined in masala-parser.d.ts:118

  Returns a new Try that will succeed only if first is a success AND is the predicate is accepted on the value

  #### Parameters

  - ##### predicate: function

    - - (value: V): boolean

      - #### Parameters

        - ##### value: V

        #### Returns boolean

  #### Returns Try<V, E>

### flatMap

- flatMap<T>(bindCall: function): Try<T, E>

- - Defined in masala-parser.d.ts:88

  #### Type parameters

  - #### T

  #### Parameters

  - ##### bindCall: function

    - - (v: V): Try<T, E>

      - #### Parameters

        - ##### v: V

        #### Returns Try<T, E>

### isFailure

- isFailure(): boolean

- - Defined in masala-parser.d.ts:67

  #### Returns boolean

### isSuccess

- isSuccess(): boolean

- - Defined in masala-parser.d.ts:65

  #### Returns boolean

### lazyRecoverWith

- lazyRecoverWith<T>(recoverFunction: function): V | T

- - Defined in masala-parser.d.ts:111

  Will call a provider accepting the error as argument when the try as failed, or the success value.

  #### Type parameters

  - #### T

  #### Parameters

  - ##### recoverFunction: function

    - - (error?: E): T

      - #### Parameters

        - ##### Optional error: E

        #### Returns T

  #### Returns V | T

### map

- map<T>(bindCall: function): Try<T, E>

- - Defined in masala-parser.d.ts:86

  Transform the success value. If `map()` throws an error, then we have a failure.

  #### Type parameters

  - #### T

  #### Parameters

  - ##### bindCall: function

    - - (v: V): T

      - #### Parameters

        - ##### v: V

        #### Returns T

  #### Returns Try<T, E>

### onFailure

- onFailure(f: function): Try<V, E>

- - Defined in masala-parser.d.ts:79

  Acts like a mapper called only in case of failure

  #### Parameters

  - ##### f: function

    - - (e: E): void

      - #### Parameters

        - ##### e: E

        #### Returns void

  #### Returns Try<V, E>

### onSuccess

- onSuccess<T>(f: function): Try<V, E>

- - Defined in masala-parser.d.ts:73

  Acts like a mapper called only in case of success

  #### Type parameters

  - #### T

  #### Parameters

  - ##### f: function

    - - (v: V): void

      - #### Parameters

        - ##### v: V

        #### Returns void

  #### Returns Try<V, E>

### recoverWith

- recoverWith<T>(otherValue: T): V | T

- - Defined in masala-parser.d.ts:104

  Will provide another value in case of failure

  #### Type parameters

  - #### T

  #### Parameters

  - ##### otherValue: T

  #### Returns V | T

### success

- success(): V

- - Defined in masala-parser.d.ts:93

  Returns the success value

  #### Returns V

Generated using TypeDoc