Commit aa5b8c8c authored by rockyl's avatar rockyl

增加服务端列表出错的容错

parent fa98b350
......@@ -22,8 +22,8 @@ export const envStore = {
mutations: {
updateEnv(state, env) {
Object.assign(state, env);
parseItem(state.processes);
parseItem(state.scripts);
state.processes = parseItem(state.processes);
state.scripts = parseItem(state.scripts);
state.initialized = true;
},
......@@ -90,7 +90,16 @@ function groupProcesses(processes, filterFunc) {
}
function parseItem(list) {
let hasError, result = [];
for (let i = 0, li = list.length; i < li; i++) {
list[i] = JSON.parse(list[i].data);
try {
result.push(JSON.parse(list[i].data));
} catch (e) {
hasError = true;
}
}
if (hasError) {
console.warn('parse env error');
}
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment