-
Notifications
You must be signed in to change notification settings - Fork 919
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
Implement error codes and exceptions for error handling #766
Draft
SteffenL
wants to merge
97
commits into
webview:master
Choose a base branch
from
SteffenL:up/improve-error-handling
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Was meant to have more C style but it does not really matter in this test.
SteffenL
force-pushed
the
up/improve-error-handling
branch
from
July 8, 2022 13:23
d2c3a58
to
48da1f1
Compare
SteffenL
force-pushed
the
up/improve-error-handling
branch
3 times, most recently
from
July 8, 2022 17:03
98b6187
to
569446a
Compare
SteffenL
force-pushed
the
up/improve-error-handling
branch
from
July 8, 2022 17:06
569446a
to
b8ecd9b
Compare
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR I wish to propose changing the API and improving error handling throughout the library in a way that is intended to be backward-compatible for current users of the C API.
This work allows both C API and C++ API users to handle errors or at the very least detect that an error has occurred and then respond accordingly to minimize crashes due to invalid state.
Although this work is not finished, it is a good time to begin discussions.
Specific changes
void
return types to an error code type for all of the functions of the C API that could benefit from returning an error code.webview_create_with_options
that takes a struct as a parameter.webview_create
when we need more options.minimum_required_version
option is checked for compatibility and allows us to change behavior based on the version set by the caller.webview_show
function to show the window on-demand. This demonstrates how we can change some behavior while providing backward-compatibility. The new behavior is to hide the window initially which requires users to callwebview_show
when they are ready.webview_create
andwebview::webview(bool debug, void *wnd)
.@since 0.11
to the new C API functions so that we can track in which version a feature was added, but there is nothing in this project that uses this style of commenting. Later I think we should adapt the documentation comments for a documentation generator.Tasks
Won't Do