File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed
Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,14 @@ export default (app) => {
2424 }
2525
2626 // save new question
27- try {
28- const question = new Question ( {
29- text,
30- expirationDate : moment ( expirationDate ) . toDate ( ) ,
31- owner : req . user . id ,
32- } ) ;
33- await question . save ( ) ;
27+ const question = new Question ( {
28+ text,
29+ expirationDate : moment ( expirationDate ) . toDate ( ) ,
30+ owner : req . user . id ,
31+ } ) ;
32+ await question . save ( ) ;
3433
35- // send created question back
36- res . send ( question ) ;
37- } catch ( e ) {
38- res . stats ( 400 ) . send ( { error : e . toString ( ) } ) ;
39- }
34+ // send created question back
35+ res . send ( question ) ;
4036 } ) ) ;
4137} ;
Original file line number Diff line number Diff line change @@ -60,12 +60,7 @@ export default (app) => {
6060 user . password = hash ( password ) ;
6161 }
6262 // try to save
63- try {
64- await user . save ( ) ;
65- } catch ( e ) {
66- res . status ( 400 ) . send ( { error : e . toString ( ) } ) ;
67- return ;
68- }
63+ await user . save ( ) ;
6964
7065 // send succcess
7166 delete user . password ;
You can’t perform that action at this time.
0 commit comments