Inherits from NSObject
Declared in NMBResponse.h

Overview

NMBResponse represents the result of NMBPromise. It contains a result value if the promise succeeds, or an error if the promise fails.

Properties

error

The error of the failed promise. It is always nil if the promise succeeds.

@property (nonatomic, readonly) NSError *error

Declared In

NMBResponse.h

isCancelled

Indicates if the reciever is a response of a cancelled promise.

@property (nonatomic, readonly) BOOL isCancelled

Discussion

Because a cancelled promise is regarded as a failed promise, and returns a special cancel error. Thereby this attribute returns YES if the related promise fails due to being cancelled, and returns NO if the promise fails due to other reason or succeeds.

Declared In

NMBResponse.h

isSuccess

Indicates if the reciever is a response of a succeeded promise or a failed promise.

@property (nonatomic, readonly) BOOL isSuccess

Declared In

NMBResponse.h

result

The result of the succeeded promise. It is always nil if the promise fails.

@property (nonatomic, readonly) id result

Declared In

NMBResponse.h

Class Methods

fail:error:

Initializes a new response contains an error of a failed promise.

+ (instancetype)fail:(NMBPromise *)promise error:(NSError *)error

Parameters

promise

The related promise.

error

The error of the failed promise.

Declared In

NMBResponse.h

success:result:

Initializes a new response contains a result of a succeeded promise.

+ (instancetype)success:(NMBPromise *)promise result:(id)result

Parameters

promise

The related promise.

result

The result of the succeeded promise.

Declared In

NMBResponse.h