Skip to content

Unhandled promise rejection #4

@hdrut

Description

@hdrut

I had to add a try-catch block in this module and throw an exception to handle case when Smartconfig is not successful :

        try{
          for (IEsptouchResult resultInList : result) {
            if(!resultInList.isCancelled() && resultInList.getBssid() != null) {
              WritableMap map = Arguments.createMap();
              map.putString("bssid", resultInList.getBssid());
              map.putString("ipv4", resultInList.getInetAddress().getHostAddress());
              ret.pushMap(map);
              resolved = true;                  
              if (!resultInList.isSuc()) {
                //Log.d(TAG, "Not successful!");
                break;                    
              }                
            }
          }
          if(resolved) {
            Log.d(TAG, "Success in Smartconfig run");
            promise.resolve(ret);
          } else {
            //Log.d(TAG, " " + resolved);
            throw new Exception();
          }
        } catch(Exception e){ 
            Log.d(TAG, "Error, Smartconfig could not complete!");
            promise.reject("new Exception()", e);
          } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions