X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Finstantiate%2FlaunchNetworkServiceSource.js;h=d5c33c11dc49e374e8c739717170115ab17071ea;hp=3a8886cef4ddc1f32a447a5b86018a715379c36b;hb=c09a6948835c9e519829e44f20d649a0dc555f3e;hpb=dfe972ff7c9f7b6b1d730e66b0b2aa8df2ce329b diff --git a/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js b/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js index 3a8886cef..d5c33c11d 100644 --- a/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js +++ b/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js @@ -128,7 +128,16 @@ export default function(Alt){ }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject(); + var error = null; + if(xhr.responseText) { + try { + error = JSON.parse(xhr.responseText); + error = JSON.parse(error.error)['rpc-reply']['rpc-error']['error-message']; + } catch(e){ + console.log(e); + } + } + reject(error); }); }) }, @@ -200,7 +209,13 @@ export default function(Alt){ beforeSend: Utils.addAuthorizationStub, contentType: "application/json", success: function(data) { - resolve(data["rw-launchpad:resource-orchestrator"]); + let returnedData; + if (data.hasOwnProperty("rw-launchpad:resource-orchestrator")) { + returnedData = data['rw-launchpad:resource-orchestrator']; + } else { + returnedData = {}; + } + resolve(returnedData); }, error: function(error) { console.log("There was an error updating the account: ", arguments);