-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
I can't find any informations about error handling, for instance i want to check for write_failed_due_to_invalid_input from https://github.com/openfga/go-sdk/blob/v0.7.1/docs/ErrorCode.md
Please provide an example
Current try:
if _, err = service.fgaClient.
Write(ctx).
Body(openfgaclient.ClientWriteRequest{
Writes: writes,
Deletes: deletes,
}).
Execute(); err != nil {
var fgaErr *openfga.FgaApiError
if errors.As(err, &fgaErr) {
switch fgaErr.ResponseCode() {
case string(openfga.ERRORCODE_WRITE_FAILED_DUE_TO_INVALID_INPUT):
return nil, service.statusError.InvalidArgumentError(fgaErr.Error()).Err()
}
}
statusErr := service.statusError.InternalError()
service.logger.Error(fmt.Sprintf("openfga client write: %s", err), logging.ExtractFields(ctx)...)
return nil, statusErr.Err()
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog