mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 04:49:11 +08:00
throwing
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@
|
||||
"no-throw-literal": [2],
|
||||
"yoda": [1],
|
||||
"no-path-concat": [2],
|
||||
"no-process-exit": [0],
|
||||
"no-process-exit": [2],
|
||||
"eol-last": [1],
|
||||
"no-continue": [1],
|
||||
"no-nested-ternary": [1],
|
||||
|
||||
+10
-4
@@ -1,7 +1,13 @@
|
||||
const Setting = require('../models/setting');
|
||||
const defaults = {id: '1', moderation: 'pre'};
|
||||
|
||||
Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true}).then(() => {
|
||||
console.log('created settings object.');
|
||||
process.exit();
|
||||
}).catch(console.error);
|
||||
try {
|
||||
Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true})
|
||||
.then(() => {
|
||||
console.log('Created settings object.');
|
||||
}).catch((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Cannot create settings object.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user