Better error reporting on instantiate page
[osm/UI.git] / skyquake / plugins / launchpad / src / instantiate / launchNetworkServiceSource.js
index 5bd3443..d5c33c1 100644 (file)
@@ -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);
           });
         })
       },
@@ -202,7 +211,7 @@ export default function(Alt){
                   success: function(data) {
                     let returnedData;
                     if (data.hasOwnProperty("rw-launchpad:resource-orchestrator")) {
-                      returnedData = data;
+                      returnedData = data['rw-launchpad:resource-orchestrator'];
                     } else {
                       returnedData = {};
                     }