Call error callback if server can't start

This commit is contained in:
boedy 2019-05-13 15:08:15 +02:00
parent 64b5089b6b
commit d43bf3b77c

View File

@ -124,6 +124,8 @@
try self.webServer.start(options:[GCDWebServerOption_AutomaticallySuspendInBackground : false, GCDWebServerOption_Port: UInt(port)])
} catch let error {
print(error.localizedDescription)
self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: error.localizedDescription), callbackId: command.callbackId)
return
}
let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK)
self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)