package com.artirigo.kontaktio;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactMethod;

import com.kontakt.sdk.android.ble.connection.OnServiceReadyListener;
import com.kontakt.sdk.android.ble.manager.ProximityManager;

public class ScanManager {
    private ProximityManager proximityManager;

    ScanManager(ProximityManager proximityManager) {
        this.proximityManager = proximityManager;
    }

    void startScanning(Promise promise) {
        try {
            proximityManager.connect(new OnServiceReadyListener() {
                @Override
                public void onServiceReady() {
                    proximityManager.startScanning();
                }
            });
            promise.resolve(null);
        } catch (Exception e) {
            promise.reject(Constants.EXCEPTION, e);
        }
    }

    void stopScanning(Promise promise) {
        try {
            if (proximityManager.isScanning()) {
                proximityManager.stopScanning();
                promise.resolve(null);
            } else {
                promise.reject(Constants.ERROR, "Can't stop scanning because device is currently not scanning.");
            }
        } catch (Exception e) {
            promise.reject(Constants.EXCEPTION, e);
        }
    }

    void restartScanning(Promise promise) {
        try {
            if (proximityManager.isScanning()) {
                proximityManager.restartScanning();
                promise.resolve(null);
            } else {
                // start scanning if device is not scanning already
                proximityManager.startScanning();
//                promise.reject(Constants.ERROR, "Can't restart scanning because device is currently not scanning.");
            }
        } catch (Exception e) {
            promise.reject(Constants.EXCEPTION, e);
        }
    }
}

@@ -1086,45 +1086,34 @@
     
-promise.reject(Constants.ERROR, 
+throw new Exception(
 %22Can
-'
+no
 t st
@@ -1447,47 +1447,8 @@
 ();%0A
-                promise.resolve(null);%0A
     
@@ -1456,32 +1456,32 @@
        %7D else %7B%0A
+
                 
@@ -1586,14 +1586,22 @@
 ();%0A
-//
     
+        %7D%0A
     
@@ -1622,112 +1622,20 @@
 e.re
-ject(Constants.ERROR, %22Can't restart scanning because device is currently not scanning.%22);%0A            %7D
+solve(null);
 %0A   

Add resolve call to else case of restartScanning function and throw Exception in stopScanning method