-
Notifications
You must be signed in to change notification settings - Fork 150
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
Fix: reason return on rest api error #757
Conversation
WalkthroughThe update is a minor yet crucial enhancement focusing on improving error handling within the system. It specifically adjusts how error reasons are processed, ensuring that they are consistently converted to strings. This change aids in standardizing the error logging or handling mechanism, making it easier to understand and diagnose issues by ensuring error messages are always in a readable and expected format. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- ledfx/api/init.py (1 hunks)
Additional comments: 2
ledfx/api/__init__.py (2)
- 65-65: Converting
reason[0]
to a string usingstr()
is a good practice for ensuring that the error message is serializable and user-friendly. This change aligns with the PR's objective to improve error handling by making error messages more comprehensible to end-users.- 67-67: Similarly, converting the exception
e
to a string usingstr()
is a positive change. It ensures that exceptions are handled gracefully and that error messages are suitable for display in client applications, enhancing the user experience by providing clearer error information.
* Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls
* feat: Expose melbank configurations via API * Remove melbanks API endpoint and fix melbanks config population * Expose audio analysis methods via API * Update sentry-sdk to be >= * build: refactor sentry init, refactor spec files, wheel workflow, add sha and release to info.py * Change audio frame size mismatch logging level to debug * Add saturation threshold to Glitch effect * Fix error message return for trying to create a device with existing ip * Add BaseConfigUpdateEvent and handle base configuration updates * Add websocket docs and capture _sender connection reset errors. * Update incorrect docstring * Add handling for non-subscribable events in WebsocketConnection * chore(deps): update dependency pytest to v8.0.1 * Add automated update checker with notifications and API endpoint * Use slicing for saturation clipping and add option for fixing hues in HSV effect * Fix: reason return on rest api error (#757) * Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls * Fix handling of complex reason failures on rest calls * fix(deps): update dependency python-mbedtls to v2.9.2 * Fix: remove redundant melbank NaN clean (#755) * Update dependency pre-commit to v3.6.2 * Fix DDP connections error to warn once * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update dependency sentry-sdk to v1.40.5 * Add event firing for device deactivation from errors and error recovery * Fix openrgb device type * Move renovate to .github and enable automerge for minor/patch updates * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v3.15.0 → v3.15.1](asottile/pyupgrade@v3.15.0...v3.15.1) * Update renovate.json with additional helpers * Fix renovate config * Remove gha digests from renovate * Initial addition of frontend source * Remove electron/storybook options * Update branding and remove references to hacking * Remove automatic starring of repos * Further removal of starring * Update websocket event names * Add LedFx to sidebar * Use backend update checker to check and notify for updates * Remove additional electron artifacts * Rebuild frontend and add deploy scripts * Update documentation and re-add frontend development setup * Release 2.0.94 * Add frontend-ci to validate frontend changes * Update frontend-ci.yml to install NPM packages in the frontend directory * Update Yarn to v1.22.21 * Add frontend directory to build step * Update dependency eslint-plugin-import to v2.29.1 * Update dependency strip-ansi to v7 * Update dependency ts-deepmerge to v7 * Update dependency base32-encode to v2 * Fix conditional check for openRGB devices * Update CI/CD workflows to reduce action usage and prevent early sentry notifications * Add environment for approval prior to release creation/publishing * Update typescript-eslint monorepo to v7 * Update storybook monorepo to v7.6.17 * Update dependency eslint to v8.56.0 * Update preset categories in store and API * Update frontend/src/components/Dialogs/SceneDialogs/EditSceneDialog.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Slight cleanup of names and hooks * Fix ledfx_presets array indexing * Handle multiple enums from audio schema, fix linting and remove tempo_method --------- Co-authored-by: atod <anthony.tod@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian W. Zuckschwerdt <christian@zuckschwerdt.org> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
As per sentry example
https://ledfx-org.sentry.io/issues/4985345081/?project=4506350233321472&query=release%3Aledfx%402.0.93&referrer=release-issue-stream
If the reason return is complex, the json serialisation in the rest call response can fail.
In this case, setting min freq to 0 by typing in device edit and directly hitting save allows an out of range return
The reason is an object and existing code would pass that on, leading to a generic error in the front and a report back into sentry
This fix hardens the handling of reason when found, and ensures conversion to string
Tested by forcing the zero value in min freq and hitting save, now reports correct reason string to front end. No crash trace triggered in console
Note call to repr(e) was replaced with str(e) due to advice from chatgpt. quoting...
Use of str() Over repr(): While repr(e) is also a string, str(e) is generally more user-friendly and intended for end-user display. This change makes the error message more suitable for inclusion in a JSON response intended for client applications.
Summary by CodeRabbit