@@ -196,8 +196,8 @@ func resourceBranchRestrictionsCreate(ctx context.Context, d *schema.ResourceDat
196
196
workspace := d .Get ("owner" ).(string )
197
197
branchRestrictionReq , _ , err := brApi .RepositoriesWorkspaceRepoSlugBranchRestrictionsPost (c .AuthContext , * branchRestriction , repo , workspace )
198
198
199
- if err != nil {
200
- return diag . FromErr ( err )
199
+ if diag := handleClientError ( err ); diag != nil {
200
+ return diag
201
201
}
202
202
203
203
d .SetId (string (fmt .Sprintf ("%v" , branchRestrictionReq .Id )))
@@ -218,8 +218,8 @@ func resourceBranchRestrictionsRead(ctx context.Context, d *schema.ResourceData,
218
218
return nil
219
219
}
220
220
221
- if err != nil {
222
- return diag . FromErr ( err )
221
+ if diag := handleClientError ( err ); diag != nil {
222
+ return diag
223
223
}
224
224
225
225
d .SetId (string (fmt .Sprintf ("%v" , brRes .Id )))
@@ -243,8 +243,8 @@ func resourceBranchRestrictionsUpdate(ctx context.Context, d *schema.ResourceDat
243
243
* branchRestriction , url .PathEscape (d .Id ()),
244
244
d .Get ("repository" ).(string ), d .Get ("owner" ).(string ))
245
245
246
- if err != nil {
247
- return diag . FromErr ( err )
246
+ if diag := handleClientError ( err ); diag != nil {
247
+ return diag
248
248
}
249
249
250
250
return resourceBranchRestrictionsRead (ctx , d , m )
@@ -262,8 +262,8 @@ func resourceBranchRestrictionsDelete(ctx context.Context, d *schema.ResourceDat
262
262
return nil
263
263
}
264
264
265
- if err != nil {
266
- return diag . FromErr ( err )
265
+ if diag := handleClientError ( err ); diag != nil {
266
+ return diag
267
267
}
268
268
269
269
return nil
0 commit comments