Skip to content

templates: route the task form's COMPLETE catch through apiErrors, not raw e.message (#7296) - #7315

Open
nedelcho-delchev-tues wants to merge 1 commit into
eclipse-dirigible:masterfrom
nedelcho-delchev-tues:issue-7296-task-form-error-handling
Open

templates: route the task form's COMPLETE catch through apiErrors, not raw e.message (#7296)#7315
nedelcho-delchev-tues wants to merge 1 commit into
eclipse-dirigible:masterfrom
nedelcho-delchev-tues:issue-7296-task-form-error-handling

Conversation

@nedelcho-delchev-tues

Copy link
Copy Markdown
Contributor

Summary

  • #7271/#7263 routed the admin page, the my/partner list and calendar loads, the report page and the generic submit() through apiErrors.refusalMessageFor — but not the path every process user task actually takes.
  • FormIntentGenerator's generated COMPLETE catch read error.data.message, and the $http compat shim in template-form-builder-harmonia's form.js.template collapsed a caught error into { data: { message: e.message } } before that, discarding httpStatus/errorMessage entirely — so a 500 from POST /services/inbox/tasks/{id} (a repository throwing inside a check gate, a constraint the 409 mapper does not know) printed the raw Hibernate/JDBC sentence on the task form.
  • form.js.template: the $http shim's rejection now also carries httpStatus/errorMessage at the top level (ApiError's shape), alongside the legacy data.message field kept for .form code authored against the old shim.
  • FormIntentGenerator: the generated COMPLETE catch now calls App.services.apiErrors.refusalMessageFor(error, 'Submit failed.') instead of reading error.data.message.
  • template-bpm's trigger-new-process.form.template scaffold had the identical error.data.message pattern in its own alert() — same code shape, same fix (grepped sibling templates per the repo's own convention).
  • IntentEmissionCoverageIT's generated-page walk now also flags error.data.message, the third spelling of the raw-message defect (neither of the existing two patterns matched it, which is why the walk missed this surface in the first place).
  • Added TaskFormApiErrorTest (mirrors the existing FormCancelActionTest): no forms:/userTask form binding exists in IntentEmissionCoverageIT's giant fixture to exercise gen/.../forms/*/form.js, so FormIntentGenerator's fix is unit-tested directly against its generated code field instead of growing that fixture.

Test plan

  • mvn formatter:validate (repo-wide) — BUILD SUCCESS
  • TaskFormApiErrorTest + FormCancelActionTest (unit, engine-intent) — green
  • mvn -pl tests/tests-integrations -am -P integration-tests -Dit.test=IntentEmissionCoverageIT -D selenide.headless=true install — green
  • Not run: the Selenide BPMStarterTemplateIT that exercises the template-bpm scaffold end to end — the touched line is the failure-path alert() text only, the success path the test asserts on is unchanged, and the JSON/JS is valid by inspection

Fixes #7296

🤖 Generated with Claude Code

…t raw e.message (eclipse-dirigible#7296)

eclipse-dirigible#7271/eclipse-dirigible#7263 routed the admin page, the my/partner list and calendar loads, the
report page and the generic submit() through apiErrors.refusalMessageFor - but
not the path every process user task actually takes. FormIntentGenerator's
generated COMPLETE catch read `error.data.message`, and the $http compat shim
in template-form-builder-harmonia's form.js.template collapsed a caught error
into `{ data: { message: e.message } }` before that, discarding httpStatus/
errorMessage entirely - so a 500 from POST /services/inbox/tasks/{id} (a
repository throwing inside a check gate, a constraint the 409 mapper does not
know) printed the raw Hibernate/JDBC sentence on the task form.

- form.js.template: the $http shim's rejection now also carries httpStatus/
  errorMessage at the top level (ApiError's shape), alongside the legacy
  data.message field kept for .form code authored against the old shim.
- FormIntentGenerator: the generated COMPLETE catch now calls
  App.services.apiErrors.refusalMessageFor(error, 'Submit failed.') instead of
  reading error.data.message.
- template-bpm's trigger-new-process.form.template scaffold had the identical
  error.data.message pattern in its own alert() - same code shape, same fix.
- IntentEmissionCoverageIT's generated-page walk now also flags
  `error.data.message`, the third spelling of the raw-message defect (neither
  of the existing two patterns matched it, which is why the walk missed this
  surface in the first place).
- Added TaskFormApiErrorTest (mirrors FormCancelActionTest): no `forms:`/
  userTask form binding exists in IntentEmissionCoverageIT's giant fixture to
  exercise gen/.../forms/*/form.js, so FormIntentGenerator's fix is unit-tested
  directly against its generated `code` field instead of growing that fixture.

Verified: mvn formatter:validate (repo-wide, BUILD SUCCESS); TaskFormApiErrorTest
and FormCancelActionTest green; IntentEmissionCoverageIT green. Not run: the
Selenide BPMStarterTemplateIT that exercises the template-bpm scaffold end to
end - the touched line is the failure-path alert() text only, the success path
the test asserts on is unchanged, and the JSON/JS is valid by inspection.

Fixes eclipse-dirigible#7296

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

templates: the task form's COMPLETE path still prints the raw error message, and the #7271 IT walk cannot see it (#7263 follow-up)

1 participant