Commit aa5b8c8c authored by rockyl's avatar rockyl

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

parent fa98b350
...@@ -22,8 +22,8 @@ export const envStore = { ...@@ -22,8 +22,8 @@ export const envStore = {
mutations: { mutations: {
updateEnv(state, env) { updateEnv(state, env) {
Object.assign(state, env); Object.assign(state, env);
parseItem(state.processes); state.processes = parseItem(state.processes);
parseItem(state.scripts); state.scripts = parseItem(state.scripts);
state.initialized = true; state.initialized = true;
}, },
...@@ -90,7 +90,16 @@ function groupProcesses(processes, filterFunc) { ...@@ -90,7 +90,16 @@ function groupProcesses(processes, filterFunc) {
} }
function parseItem(list) { function parseItem(list) {
let hasError, result = [];
for (let i = 0, li = list.length; i < li; i++) { 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