Commit a6d061b6 authored by Sachinda 's avatar Sachinda

error rejetc

parent d41c338a
......@@ -138,10 +138,14 @@ module.exports = {
await validateDbmodel(singleElement);
loopinfo['db_name'] = singleElement.db_name
} catch (error) {
loopinfo['error'] = 'Db Model Validation Error';
loopinfo['debug_info'] = error;
infologs.push(loopinfo);
continue;
// throw error;
return reject(error);
// loopinfo['error'] = 'Db Model Validation Error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
var db = await dbconnectionMaker(singleElement.user_name, singleElement.password, singleElement.service_url, singleElement.service_port);
......@@ -149,10 +153,13 @@ module.exports = {
var dbexist = await checkDbexist(db, singleElement.db_name);
loopinfo['dbexist'] = true;
} catch (error) {
loopinfo['error'] = 'Db Exist check error';
loopinfo['debug_info'] = error;
infologs.push(loopinfo);
continue;
return reject(error);
//throw error;
// loopinfo['error'] = 'Db Exist check error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
......@@ -162,10 +169,15 @@ module.exports = {
await dbcreate(db, singleElement.db_name);
loopinfo['create db '] = true;
} catch (error) {
loopinfo['error'] = 'Db Create Error';
loopinfo['debug_info'] = error;
infologs.push(loopinfo);
continue;
return reject(error);
//throw error;
// loopinfo['error'] = 'Db Create Error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
// db does not exist create new one
}
......@@ -180,10 +192,12 @@ module.exports = {
var insertViewmodel = await insertDocument(select_db, singleElement.view_document);
viewinfodoc = 'Document not found insert as new';
} catch (error) {
viewinfodoc = {
'error': 'Insert View model error 1',
"debug": error
};
return reject(error);
//throw error;
// viewinfodoc = {
// 'error': 'Insert View model error 1',
// "debug": error
// };
}
//console.log('insertViewmodel :>> ', insertViewmodel);
} else {
......@@ -198,10 +212,13 @@ module.exports = {
console.log('insertViewmodel :>> ', insertViewmodel);
viewinfodoc = 'Document found does not Equals to old one';
} catch (error) {
viewinfodoc = {
'error': 'Insert View model error 2',
"debug": error
};
return reject(error);
//throw error;
// viewinfodoc = {
// 'error': 'Insert View model error 2',
// "debug": error
// };
}
} else {
......@@ -210,8 +227,10 @@ module.exports = {
}
loopinfo['view_document'] = viewinfodoc;
} catch (error) {
loopinfo['error'] = 'view_document check exist error';
loopinfo['debug_info'] = error;
return reject(error);
// throw error;
// loopinfo['error'] = 'view_document check exist error';
// loopinfo['debug_info'] = error;
}
}
/* index_document */
......@@ -224,10 +243,13 @@ module.exports = {
indexinfodoc = 'Document not found insert as new';
console.log('index_document :>> ', index_document);
} catch (error) {
indexinfodoc = {
'error': 'Insert Index document error',
"debug": error
};
return reject(error);
// throw error;
// indexinfodoc = {
// 'error': 'Insert Index document error',
// "debug": error
// };
}
} else {
var rev = doc._rev;
......@@ -241,10 +263,12 @@ module.exports = {
indexinfodoc = 'Document found does not Equals to old one';
console.log('insertmodel :>> ', insertmodel);
} catch (error) {
indexinfodoc = {
'error': 'Insert View model error',
"debug": error
};
return reject(error);
//throw error;
// indexinfodoc = {
// 'error': 'Insert View model error',
// "debug": error
// };
}
} else {
indexinfodoc = 'Document found Equals to old one';
......@@ -252,8 +276,10 @@ module.exports = {
}
loopinfo['index_document'] = indexinfodoc;
} catch (error) {
loopinfo['error'] = 'index_document check exist error';
loopinfo['debug_info'] = error;
return reject(error);
//throw error;
// loopinfo['error'] = 'index_document check exist error';
// loopinfo['debug_info'] = error;
}
}
/* update handler */
......@@ -267,10 +293,13 @@ module.exports = {
console.log('index_document :>> ', insertmodel);
updatehandleinfodoc = 'Document not found insert as new';
} catch (error) {
updatehandleinfodoc = {
'error': 'Insert Update handler document error',
"debug": error
};
return reject(error);
//throw error;
// updatehandleinfodoc = {
// 'error': 'Insert Update handler document error',
// "debug": error
// };
}
} else {
var rev = doc._rev;
......@@ -284,31 +313,38 @@ module.exports = {
console.log('insertmodel :>> ', insertmodel);
updatehandleinfodoc = 'Document found does not Equals to old one';
} catch (error) {
updatehandleinfodoc = {
'error': 'Insert Update handler document error',
"debug": error
};
return reject(error);
//throw error;
// updatehandleinfodoc = {
// 'error': 'Insert Update handler document error',
// "debug": error
// };
}
} else {
updatehandleinfodoc = 'Document found Equals to old one';
}
}
} catch (error) {
loopinfo['error'] = 'Update handler check exist error';
loopinfo['debug_info'] = error;
return reject(error);
//throw error;
// loopinfo['error'] = 'Update handler check exist error';
// loopinfo['debug_info'] = error;
}
loopinfo['Update_handler_document'] = updatehandleinfodoc;
}
infologs.push(loopinfo);
} catch (error) {
infologs.push({
"db_name": singleElement.db_name,
"error": error
})
console.log('error', error)
return reject(error);
// infologs.push({
// "db_name": singleElement.db_name,
// "error": error
// })
// console.log('error', error)
}
}
return resolve(infologs);
})
}
}
\ No newline at end of file
}
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