Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling code #1530

Open
1 task done
miparnisari opened this issue Apr 11, 2024 · 0 comments
Open
1 task done

Improve error handling code #1530

miparnisari opened this issue Apr 11, 2024 · 0 comments
Labels
refactor A cleanup is needed

Comments

@miparnisari
Copy link
Member

miparnisari commented Apr 11, 2024

Checklist

Describe the problem you'd like to have solved

Design concern in our codebase: if an API call bubbles up an error that isn't understood by our mapping layer (

func NewEncodedError(errorCode int32, message string) *EncodedError {
) we default to throwing HTTP 500, which is non-ideal: (the SDKs will automatically retry, it can trigger alarms, etc).

See some occurrences of this problem:

Describe the ideal solution

A suggested pattern by folks at Okta is:

  • Define top level errors that represent common error categories
  • Inside domain/internal packages, canonicalize all package specific errors into those top level errors.
  • Domain packages should know how to canonicalize those top level errors into package-specific errors when necessary, like in the case of a grpc server

This is a suggestion, we can do some discovery around what would work best works for us given that, ideally, error handling between OpenFGA and Okta FGA is consistent. Whatever we do, we need team buy-in.

Alternatives and current workarounds

No response

Additional context

No response

@miparnisari miparnisari added enhancement New feature or request refactor A cleanup is needed and removed enhancement New feature or request labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A cleanup is needed
Projects
None yet
Development

No branches or pull requests

1 participant