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 AuthorizationModelResolutionTooComplex error #1410

Open
1 task done
miparnisari opened this issue Feb 29, 2024 · 1 comment
Open
1 task done

Improve AuthorizationModelResolutionTooComplex error #1410

miparnisari opened this issue Feb 29, 2024 · 1 comment
Labels
refactor A cleanup is needed Stale

Comments

@miparnisari
Copy link
Member

miparnisari commented Feb 29, 2024

Checklist

Describe the problem you'd like to have solved

if errors.Is(err, graph.ErrResolutionDepthExceeded) || errors.Is(err, graph.ErrCycleDetected) {

appears in three different locations in the codebase today.

  1. if errors.Is(err, graph.ErrResolutionDepthExceeded) || errors.Is(err, graph.ErrCycleDetected) {
    resultsChan <- ListObjectsResult{Err: serverErrors.AuthorizationModelResolutionTooComplex}
    return
    }
  2. if errors.Is(err, graph.ErrResolutionDepthExceeded) || errors.Is(err, graph.ErrCycleDetected) {
    err = serverErrors.AuthorizationModelResolutionTooComplex
    }
  3. if errors.Is(err, graph.ErrResolutionDepthExceeded) || errors.Is(err, graph.ErrCycleDetected) {
    return nil, serverErrors.AuthorizationModelResolutionTooComplex
    }

And I suppose we will need to have it also for the future ListUsers API.

Describe the ideal solution

Remove the code duplication. We can keep AuthorizationModelResolutionTooComplex, remove the others, and update AuthorizationModelResolutionTooComplex to hold the actual cause of the error 🤔

Alternatives and current workarounds

No response

Additional context

No response

@miparnisari miparnisari added the refactor A cleanup is needed label Feb 29, 2024
@miparnisari miparnisari changed the title Improve AuthorizationModelResolutionTooComplex Improve AuthorizationModelResolutionTooComplex error Feb 29, 2024
Copy link

It appears this issue has been stale for at least 14 days 🗓️. If no action is taken the maintainer team may consider closing the issue. Please reach out if you need feedback or follow up actions from the maintainer team.

@github-actions github-actions bot added the Stale label Mar 15, 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 Stale
Projects
None yet
Development

No branches or pull requests

1 participant