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

feat: Add canonical error codes for generic error handling. #2711

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Feb 23, 2024

Every error enum should have a conversion function to the canonical codes list. This can make client code more resilient to additions of error codes to per-function error enums, and simplify much of the error handling that currently needs to switch() over each error enum separately.

It's still useful to have additional information from the per-function error enums to present the user with better error messages, but for programmatic error handling (e.g. bots), the canonical codes should always be sufficient context.


This change is Reviewable

Every error enum should have a conversion function to the canonical
codes list. This can make client code more resilient to additions of
error codes to per-function error enums, and simplify much of the error
handling that currently needs to `switch()` over each error enum
separately.

It's still useful to have additional information from the per-function
error enums to present the user with better error messages, but for
programmatic error handling (e.g. bots), the canonical codes should
always be sufficient context.
@iphydf iphydf added this to the v0.2.20 milestone Feb 23, 2024
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 73.05%. Comparing base (77e0887) to head (e8b2925).
Report is 41 commits behind head on master.

Files Patch % Lines
toxcore/tox_api.c 0.00% 28 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2711   +/-   ##
=======================================
  Coverage   73.05%   73.05%           
=======================================
  Files         149      149           
  Lines       30517    30545   +28     
=======================================
+ Hits        22293    22314   +21     
- Misses       8224     8231    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iphydf iphydf modified the milestones: v0.2.20, v0.2.21 Mar 28, 2024
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.

1 participant