-
Notifications
You must be signed in to change notification settings - Fork 7
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
refactor: restrict webforj to one app and unfiy error handling #726
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
hyyan
added
Type: Refactor
This issue requires refactoring and might introduce a breaking change
Breaking Change
The change includes a breaking change
labels
Sep 8, 2024
github-actions
bot
added
module: foundation
The change is in the foundation module
BBj
The issue or PR is related to the webforj BBj bootstrap and helper programs
labels
Sep 8, 2024
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
Code Coverage
Files
|
Quality Gate passedIssues Measures |
This was referenced Sep 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
BBj
The issue or PR is related to the webforj BBj bootstrap and helper programs
Breaking Change
The change includes a breaking change
module: foundation
The change is in the foundation module
Type: Refactor
This issue requires refactoring and might introduce a breaking change
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.
The (PR) enforces a single application limit in webforJ and shifts all error handling responsibilities to the Java side, giving developers full control over error management.
Application Discovery Rules:
During the webforJ bootstrap process, all classes that extend
com.webforj.App
are scanned. If multiple applications are found, the system looks for thecom.webforj.annotation.AppEntry
annotation. If any of the discovered classes are annotated with@AppEntry
, the first one encountered is considered the entry point.@AppEntry
, that class is selected as the entry point.@AppEntry
, an exception is thrown, listing all the discovered classes.App
is found, that class is selected as the entry point.App
are found, an exception is thrown, detailing each subclass.Error Handling
webforJ will capture all errors during the application lifecycle and forward them to the appropriate error handler through the
ErrorHandler
interface.Applications can implement this interface to manage specific exceptions. The implementing class should be named after the exception it handles, followed by the suffix
ErrorHandler
. it must be registered in thecom.webforj.error.ErrorHandler
placed in theMETA-INF/services
directory. For example, to handle ajava.lang.NullPointerException
, the class should be namedNullPointerExceptionErrorHandler
, registered incom.webforj.error.ErrorHandler
which is placed inMETA-INF/services
directory.If no error handler is found, webforJ will use its own global error handler. The default error handler will: