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

Include error message of unhandled BPMN error in log #4667

Open
sowmyahl21 opened this issue Sep 30, 2024 · 5 comments
Open

Include error message of unhandled BPMN error in log #4667

sowmyahl21 opened this issue Sep 30, 2024 · 5 comments
Assignees
Labels
group:community-contrib Issues a community member works on. type:feature Issues that add a new user feature to the project.

Comments

@sowmyahl21
Copy link

sowmyahl21 commented Sep 30, 2024

User Story (Required on creation)

As a Cockpit user, I want to be able to read the error message of a BPMN error in the log when the error can't be propagated due to a missing catching boundary event. This allows us to better identify the error and fix the problem in the BPMN model.

When a BPMN Error throws an exception, the associated error message is not logged along with the status code. This makes it difficult to diagnose the root cause of the error, as only the status code is logged when an exception is thrown.
We can see the same in the below-attached screenshot
image

Functional Requirements (Required before implementation)

When a BPMN error cannot be propagated due to a missing catching boundary event, the error message is shown in the log output (e.g., of the application server) and in Cockpit.

Technical Requirements (Required before implementation)

Adjust the log messages for logging the error and for throwing an exception for the error to include the BPMN error message.

Populate the error message from all code points that call any of the two log methods (e.g. BpmnExceptionHandler).

Test the new behavior:

  • Exception contains the error message
  • Log output contains the error message

Limitations of Scope

Hints

Links

Breakdown

Pull Requests

No tasks being tracked yet.

Dev2QA handover

  • Create a BPMN model that throws a BPMN error (with an error code and message) which is not caught by a catching boundary event.
  • Start an instance and observe the log output in cockpit
  • Configure the engine to throw an exception in those cases with engine config flag enableExceptionsAfterUnhandledBpmnError
  • Observe the error message in the logged exception
@sowmyahl21 sowmyahl21 added the type:bug Issues that describe a user-facing bug in the project. label Sep 30, 2024
@sowmyahl21
Copy link
Author

I'm interested to work on the fix. Please let me know if there are any concerns

@mboskamp
Copy link
Member

mboskamp commented Oct 2, 2024

Hi @sowmyahl21, thank you for raising a bug report. It's awesome to hear that you want to contribute a fix.

I have some questions before we commit to changing the behavior:

  • Can you share more details on how to reproduce the problem? Maybe you can share a failing BPMN.
  • Can you outline what your solution proposal would look like?
  • We should add tests to ensure that the error message is added to the log/exception.
    • Here is one example how it could be done when throwing the exception is enabled via process engine flag.
    • When the flag is not enabled and the message is only logged, we can use ProcessEngineLoggingRule to make assert the log output.
  • Is this really a bug? What exactly do you think is broken? I understand you want to add the error message of a custom BPMN error to the log output.
    • I would argue that the error message will be available when there is an error handler to process it. The message you see now is caused by the error not being propagated correctly (due to the missing handler). The error code (and potentially the message) should only help to identify which part of the BPMN to fix, correct?
    • Can we change the type of the issue to feature?

@sowmyahl21
Copy link
Author

Hi @mboskamp, thanks for your inputs. Here are some more details :

  • I have attached the bpmn file which throws BPMN error (added .txt extension as .bpmn is not supported for upload).
    throw-bpmn-error.txt
  • Overview of the proposed solution :
    Need to update propogateError method in BpmnExceptionHandler class to pass the error message in both missingBoundaryCatchEventError and missingBoundaryCatchEvent and log the same in both the methods in BpmnBehaviorLogger
  • Regarding the tests : I have gone through your suggestions and it looks good to me. Will add tests to cover these scenarios in the package - package org.camunda.bpm.engine.test.bpmn.behavior bpmn (we don't have behavior package right now)
  • Type of this issue can be changed to feature , I couldn't find an option to update the type. Do we need to create a new issue with type as feature or can it be updated?

@sowmyahl21 sowmyahl21 changed the title [BUG] Error Message is not being logged when exception is thrown by BPMN Error Error Message is not being logged when exception is thrown by BPMN Error Oct 7, 2024
@mboskamp mboskamp added type:feature Issues that add a new user feature to the project. and removed type:bug Issues that describe a user-facing bug in the project. labels Oct 8, 2024
@mboskamp mboskamp assigned sowmyahl21 and unassigned mboskamp Oct 8, 2024
@mboskamp mboskamp changed the title Error Message is not being logged when exception is thrown by BPMN Error Include error message of BPMN error in log Oct 8, 2024
@mboskamp mboskamp changed the title Include error message of BPMN error in log Include error message of unhandled BPMN error in log Oct 8, 2024
@mboskamp
Copy link
Member

mboskamp commented Oct 8, 2024

@sowmyahl21, sounds good. I changed the issue type to feature and filled in the necessary fields. Let me know if you think I did not capture the entire feature.
If you have questions during the implementation, just ping me in the PR or this issue. When you want to request a code review, feel free to assign me in the PR.

Thanks for contributing!

@mboskamp mboskamp self-assigned this Oct 8, 2024
@mboskamp mboskamp added the group:community-contrib Issues a community member works on. label Oct 8, 2024
@sowmyahl21
Copy link
Author

@mboskamp, thank you! I'll definitely reach out to you in case I need some support while making this contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group:community-contrib Issues a community member works on. type:feature Issues that add a new user feature to the project.
Projects
None yet
Development

No branches or pull requests

2 participants