Example usage for com.facebook.react.bridge Promise reject

List of usage examples for com.facebook.react.bridge Promise reject

Introduction

In this page you can find the example usage for com.facebook.react.bridge Promise reject.

Prototype

@Deprecated
void reject(String message);

Source Link

Document

Report an error which wasn't caused by an exception.

Usage

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void DeleteTable(final ReadableMap options, final Promise promise) {
    try {/*w w  w .  j a  va  2  s .  c o m*/
        final DeleteTableRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                DeleteTableRequest.class);
        final DeleteTableResult response = dynamodbClient.deleteTable(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void BatchGetItem(final ReadableMap options, final Promise promise) {
    try {//  w w w.  j a  v  a 2s  . c  o  m
        final BatchGetItemRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                BatchGetItemRequest.class);
        final BatchGetItemResult response = dynamodbClient.batchGetItem(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void DescribeTable(final ReadableMap options, final Promise promise) {
    try {// ww w  .j  av  a  2 s .  c o m
        final DescribeTableRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                DescribeTableRequest.class);
        final DescribeTableResult response = dynamodbClient.describeTable(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void PutItem(final ReadableMap options, final Promise promise) {
    try {/*from   w ww .j  a  v a 2 s.c  om*/
        final PutItemRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                PutItemRequest.class);
        final PutItemResult response = dynamodbClient.putItem(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void Query(final ReadableMap options, final Promise promise) {
    try {//from w ww.j  a va  2 s .  c o  m
        final QueryRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(), QueryRequest.class);
        final QueryResult response = dynamodbClient.query(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void Scan(final ReadableMap options, final Promise promise) {
    try {/*from  ww w.  j  av a  2s.  co  m*/
        final ScanRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(), ScanRequest.class);
        final ScanResult response = dynamodbClient.scan(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void DeleteItem(final ReadableMap options, final Promise promise) {
    try {/*from ww  w. j av  a 2  s .  c om*/
        final DeleteItemRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                DeleteItemRequest.class);
        final DeleteItemResult response = dynamodbClient.deleteItem(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void UpdateItem(final ReadableMap options, final Promise promise) {
    try {/*w w w .jav  a  2s.c om*/
        final UpdateItemRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                UpdateItemRequest.class);
        final UpdateItemResult response = dynamodbClient.updateItem(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void CreateTable(final ReadableMap options, final Promise promise) {
    try {//from w  w  w.j av  a 2 s.  co m
        final CreateTableRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                CreateTableRequest.class);
        final CreateTableResult response = dynamodbClient.createTable(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}

From source file:com.amazonaws.reactnative.dynamodb.AWSRNDynamoDBClient.java

License:Open Source License

@ReactMethod
public void BatchWriteItem(final ReadableMap options, final Promise promise) {
    try {/*from w ww.j av  a  2 s. co  m*/
        final BatchWriteItemRequest request = gson.fromJson(
                new JSONObject(AWSRNClientMarshaller.readableMapToMap(options)).toString(),
                BatchWriteItemRequest.class);
        final BatchWriteItemResult response = dynamodbClient.batchWriteItem(request);
        final WritableMap map = AWSRNClientMarshaller.jsonToReact(new JSONObject(gson.toJson(response)));
        promise.resolve(map);
    } catch (Exception e) {
        promise.reject(e);
        return;
    }
}