@@ -165,7 +165,7 @@ class GrafanaSync {
165
165
} ,
166
166
json : true ,
167
167
uri : `${ this . grafanaUri } /api/orgs/name/${ name } ` ,
168
- } ) ;
168
+ } ) . catch ( ( err ) => err . response ) ;
169
169
this . logger . debug ( { name, response } , "Got grafana organisation by name." ) ;
170
170
if ( ! response . id ) {
171
171
throw new Error ( `Could not get grafana orgatiosation by name ${ name } ` ) ;
@@ -186,7 +186,7 @@ class GrafanaSync {
186
186
} ,
187
187
json : true ,
188
188
uri : `${ this . grafanaUri } /api/orgs/${ orgId } /users` ,
189
- } ) ;
189
+ } ) . catch ( ( err ) => err . response ) ;
190
190
this . logger . debug ( { orgId, response } , "Got grafana organisation users." ) ;
191
191
if ( response . constructor !== Array ) {
192
192
return [ ] ;
@@ -210,7 +210,7 @@ class GrafanaSync {
210
210
} ,
211
211
json : true ,
212
212
uri : `${ this . grafanaUri } /api/users/lookup?loginOrEmail=${ email } ` ,
213
- } ) ;
213
+ } ) . catch ( ( err ) => err . response ) ;
214
214
this . logger . debug ( { email, response } , "Got grafana user id." ) ;
215
215
if ( response . constructor !== Object ) {
216
216
throw new Error ( `Could not get user by email: ${ email } ` ) ;
@@ -230,7 +230,7 @@ class GrafanaSync {
230
230
} ,
231
231
json : true ,
232
232
uri : `${ this . grafanaUri } /api/users/${ userId } /orgs` ,
233
- } ) ;
233
+ } ) . catch ( ( err ) => err . response ) ;
234
234
this . logger . debug ( { userId, email, response } , "Got grafana user." ) ;
235
235
if ( response . constructor !== Array ) {
236
236
throw new Error ( `Could not get user: ${ userId } ` ) ;
@@ -263,7 +263,7 @@ class GrafanaSync {
263
263
} ,
264
264
json : true ,
265
265
uri : `${ this . grafanaUri } /api/orgs/${ orgId } /users` ,
266
- } ) ;
266
+ } ) . catch ( ( err ) => err . response ) ;
267
267
this . logger . debug ( { orgId, email, role, response } , "Created grafana organisation user." ) ;
268
268
return response ;
269
269
} catch ( e ) {
@@ -285,7 +285,7 @@ class GrafanaSync {
285
285
} ,
286
286
json : true ,
287
287
uri : `${ this . grafanaUri } /api/orgs/${ orgId } /users/${ userId } ` ,
288
- } ) ;
288
+ } ) . catch ( ( err ) => err . response ) ;
289
289
this . logger . debug ( { orgId, userId, role, response } , "Updated grafana user." ) ;
290
290
return response ;
291
291
} catch ( e ) {
@@ -308,7 +308,7 @@ class GrafanaSync {
308
308
} ,
309
309
json : true ,
310
310
uri : `${ this . grafanaUri } /api/orgs/${ orgId } /users/${ userId } ` ,
311
- } ) ;
311
+ } ) . catch ( ( err ) => err . response ) ;
312
312
this . logger . debug ( { orgId, userId, response } , "Delete grafana user." ) ;
313
313
return response ;
314
314
} catch ( e ) {
0 commit comments