Skip to content

Commit

Permalink
incusd/auth/openfga: Return correct error
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Dec 1, 2023
1 parent 27fb627 commit 9a87adb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/server/auth/driver_openfga.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,13 @@ func (f *fga) updateTuples(ctx context.Context, writes []client.ClientTupleKey,

for _, write := range clientWriteResponse.Writes {
if write.Error != nil {
return fmt.Errorf("Failed to write tuple to OpenFGA store (user: %q; relation: %q; object: %q): %w", write.TupleKey.User, write.TupleKey.Relation, write.TupleKey.Object, err)
return fmt.Errorf("Failed to write tuple to OpenFGA store (user: %q; relation: %q; object: %q): %w", write.TupleKey.User, write.TupleKey.Relation, write.TupleKey.Object, writer.Error)

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / Code

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, dir)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, btrfs)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, lvm)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, zfs)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, ceph)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, cluster, random)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, dir)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, btrfs)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, lvm)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, zfs)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, ceph)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (1.20.x, standalone, random)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (stable, cluster, dir)

undefined: writer

Check failure on line 812 in internal/server/auth/driver_openfga.go

View workflow job for this annotation

GitHub Actions / System (stable, standalone, dir)

undefined: writer
}
}

for _, deletion := range clientWriteResponse.Deletes {
if deletion.Error != nil {
return fmt.Errorf("Failed to delete tuple from OpenFGA store (user: %q; relation: %q; object: %q): %w", deletion.TupleKey.User, deletion.TupleKey.Relation, deletion.TupleKey.Object, err)
return fmt.Errorf("Failed to delete tuple from OpenFGA store (user: %q; relation: %q; object: %q): %w", deletion.TupleKey.User, deletion.TupleKey.Relation, deletion.TupleKey.Object, deletion.Error)
}
}

Expand Down

0 comments on commit 9a87adb

Please sign in to comment.