package com.iotize.plugin.cordova.zebrarfid;

import org.json.JSONObject;

public abstract class AsyncJSONObjectPluginCallCallback implements AsyncMethodCallback<JSONObject, Throwable>{
    private final PluginResponse pluginResponse;

    public AsyncJSONObjectPluginCallCallback(PluginResponse pluginResponse) {
        this.pluginResponse = pluginResponse;
    }

    @Override
    public void onComplete(JSONObject result) throws Exception {
        this.pluginResponse.success(result);
    }

    @Override
    public void onError(Throwable error) throws Exception {
        this.pluginResponse.error(PluginError.fromError(error));
    }
}
