Skip to content

feat: better error message when flag key is not found in the project#520

Closed
wichopy wants to merge 2 commits intolaunchdarkly:mainfrom
wichopy:better-debug
Closed

feat: better error message when flag key is not found in the project#520
wichopy wants to merge 2 commits intolaunchdarkly:mainfrom
wichopy:better-debug

Conversation

@wichopy
Copy link
Copy Markdown

@wichopy wichopy commented Apr 14, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

when using the CLI, its not clear that the error is the flag key does not match a key thats registered in the project. The error is just "not found"

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.

@mike-zorn mike-zorn changed the title need better error message when flag key is not found in the project feat: better error message when flag key is not found in the project Apr 14, 2025
@mike-zorn
Copy link
Copy Markdown

Thanks for the submission! That makes sense that we should distinguish between the project missing and the flag missing. We've used error types to distinguish between 5xx & 4xx errors. As a result, the fmt.Errorf approach won't work. Instead we'll need to incorporate which kinds of things we didn't find in the custom error type and map that out in the API. Let me know if you wanna take that on. Otherwise, we can treat this as a feature request and implement it.

@wichopy
Copy link
Copy Markdown
Author

wichopy commented Apr 15, 2025

Thanks for the submission! That makes sense that we should distinguish between the project missing and the flag missing. We've used error types to distinguish between 5xx & 4xx errors. As a result, the fmt.Errorf approach won't work. Instead we'll need to incorporate which kinds of things we didn't find in the custom error type and map that out in the API. Let me know if you wanna take that on. Otherwise, we can treat this as a feature request and implement it.

Could i please just make a feature request then. When I was looking at the code I didn't see anything to reveal error codes with this ErrNotFound error so thought just adding the context to the error would be enough.

Feel free to take over this PR or close

@mike-zorn
Copy link
Copy Markdown

Oh. Yeah. We actually have a bug in here where we're returning 500s when it should be a 400. I'll close this one and fix up the error handling.

@mike-zorn mike-zorn closed this Apr 15, 2025
mike-zorn pushed a commit that referenced this pull request Apr 15, 2025
Expose more details about dev server errors like what thing wasn't found. Requested in #520.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants