Commit 2ad986fc authored by Stephan Handuwala's avatar Stephan Handuwala 🏋🏻

Merge branch 'master' into 'master'

Master

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