This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree 1 file changed +22
-10
lines changed
1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,20 @@ const helper = require('../common/helper')
14
14
*/
15
15
async function createUserInUbahn ( { handle, firstName, lastName } ) {
16
16
logger . debug ( `Creating user with handle ${ handle } in Ubahn` )
17
- const user = await helper . createUbahnRecord ( '/users' , {
18
- handle,
19
- firstName,
20
- lastName
21
- } )
22
17
23
- return user . id
18
+ try {
19
+ const user = await helper . createUbahnRecord ( '/users' , {
20
+ handle,
21
+ firstName,
22
+ lastName
23
+ } )
24
+
25
+ return user . id
26
+ } catch ( error ) {
27
+ logger . error ( error )
28
+ // Throw it to fail processing of this record
29
+ throw error
30
+ }
24
31
}
25
32
26
33
/**
@@ -50,10 +57,15 @@ async function createUserInTopcoder (user) {
50
57
}
51
58
}
52
59
53
- // Create the user in topcoder's Users api
54
- const newUser = await helper . createUserInTopcoder ( topcoderUser )
55
-
56
- return newUser . result . content . id
60
+ try {
61
+ // Create the user in topcoder's Users api
62
+ const newUser = await helper . createUserInTopcoder ( topcoderUser )
63
+ return newUser . result . content . id
64
+ } catch ( error ) {
65
+ logger . error ( error )
66
+ // Throw it to fail processing of this record
67
+ throw error
68
+ }
57
69
}
58
70
59
71
/**
You can’t perform that action at this time.
0 commit comments