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

Extending business exceptions through the java spi mechanism #298

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

trayliang
Copy link

@trayliang trayliang commented Jan 12, 2024

Please answer these questions before submitting a pull request

  • Why submit this pull request?
    Extending business exceptions through the java spi mechanism

  • Related issues


Bugfix

  • Description

why is it so important / why do we need this / what problem it solves.
If we are based on plug-ins, there is no way to scale our business based on exceptions
The code is so old that it doesn't know how the response body should return,
For example:

We authenticate the user through the plug-in, if the user does not have permission, theory
The upper system should tell the user that there is no access permission. Normally we can do that in java
Throw an exception and wrap the response by catching the exception

  • How to fix?

New feature or improvement

  • Describe the details and related test reports.

  • Source branch

  • Related commits and pull requests

  • Target branch

@trayliang
Copy link
Author

thanks cr

@trayliang
Copy link
Author

Hi, I just added lisence,.

@shreemaan-abhishek
Copy link

shreemaan-abhishek commented Feb 21, 2024

Extending business exceptions through the java spi mechanism

image

Please describe your changes in more detail. Abou why is it so important / why do we need this / what problem it solves.

# See the License for the specific language governing permissions and
# limitations under the License.

org.apache.apisix.plugin.runner.handler.GlobalException

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
org.apache.apisix.plugin.runner.handler.GlobalException
org.apache.apisix.plugin.runner.handler.GlobalException

you must add a blank line at the end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank. I have added a blank line at the end of this file

@trayliang
Copy link
Author

Extending business exceptions through the java spi mechanism

image

Please describe your changes in more detail. Abou why is it so important / why do we need this / what problem it solves.

If we are based on plug-ins, there is no way to scale our business based on exceptions
The code then doesn't know how the response body should return,
For example:
We authenticate the user through the plug-in, if the user does not have permission, theory
The upper system should tell the user that there is no access permission. Normally we can do that in java
Throw an exception and wrap the response by catching the exception

@monkeyDluffy6017
Copy link

This pr didn't import any new features, just refactoring, right?

@trayliang
Copy link
Author

This pr didn't import any new features, just refactoring, right?

I think this PR provides the ability to extend exceptions through spi, and I think this is also the ability of this plugin to improve

This code logic is not very difficult, maybe I describe the problem, you can look at the implementation of the code, in fact, can solve the business above the exception capture pain points

@monkeyDluffy6017
Copy link

@nic-chen please help to check

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.

3 participants