X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fframework%2Futils%2Futils.js;h=7b93fd5808e15e800b9db2fc53445f9aa5f35538;hp=fc6b5927177d9d72c2a7e13806590b4007e73997;hb=ca1da3e8781d04f526bf8462887dabc1b84b95c2;hpb=3cfa5123b73abd2b5b90917f14e4d41567bab98d diff --git a/skyquake/framework/utils/utils.js b/skyquake/framework/utils/utils.js index fc6b59271..7b93fd580 100644 --- a/skyquake/framework/utils/utils.js +++ b/skyquake/framework/utils/utils.js @@ -311,4 +311,15 @@ Utils.cleanImageDataURI = (imageString, type, id) => { return require('style/img/catalog-default.svg'); } +Utils.parseError = (error) => { + let displayMsg = JSON.parse(error); + if (displayMsg.errorMessage && displayMsg.errorMessage.body) { + displayMsg = displayMsg.errorMessage.body; + if(displayMsg['last-error'] && displayMsg['last-error']['rpc-error'] && displayMsg['last-error']['rpc-error']['error-message']) { + displayMsg = displayMsg['last-error']['rpc-error']['error-message']; + } + } + return displayMsg +} + module.exports = Utils;