Skip to content

FRAMENGG-13161 support app error - #16

Merged
cb-jananivijayan merged 3 commits into
mainfrom
FRAMENGG-13161
Jul 31, 2026
Merged

FRAMENGG-13161 support app error#16
cb-jananivijayan merged 3 commits into
mainfrom
FRAMENGG-13161

Conversation

@cb-jananivijayan

@cb-jananivijayan cb-jananivijayan commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

FRAMENGG-13161 support app error

SUMMARY

FRAMENGG-13161 support app error

FUNCTIONAL AUTOMATION CHANGES PR

  • Yes
    • If Yes, PR :
  • No
    • If No, Reason: NA

AUTOMATION TEST REPORT URL

NA

AREAS OF IMPACT

NA

TYPE OF CHANGE

  • 🐞 Bugfix
  • 🌟 Feature
  • ✨ Enhancement
  • 🧪 Unit Test Cases
  • 📔 Documentation
  • ⚙️ Chore - Build Related / Configuration / Others

DOCUMENTATION

NA

Enhanced sample apps to distinguish non-retryable application errors from transient platform failures. Added structured HTTP error status handling, duplicate-contact responses, payload validation, subscription checks, retry-aware exception behavior, and shared HandlerResult types for status codes and response bodies.

@snyk-io

snyk-io Bot commented Jul 27, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues
Secrets 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 67de0df9-5890-49ed-a1fe-21145728a71a

📥 Commits

Reviewing files that changed from the base of the PR and between b3da232 and f842415.

📒 Files selected for processing (3)
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/handler/advanceInvoiceSchedule.js
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/handler/handler.js
  • sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/handler/handler.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/handler/handler.js

Walkthrough

Sample webhook handlers now return structured 400/409 responses for non-retryable conditions, preserve HTTP status information from CRM errors, and throw transient failures so the platform can retry them. Shared HandlerResult interfaces document these return semantics.

Changes

Handler error semantics

Layer / File(s) Summary
CRM duplicate-error handling
sample-apps/.../crm_lead_on_customer_created_sample_app/handler/crmLead.js, handler/handler.js, types/types.d.ts
CRM request errors now include status metadata; duplicate contacts return HTTP 409, while other errors are rethrown. The handler result contract documents status codes and response bodies.
Advance invoice input validation
sample-apps/.../schedule_advance_invoice_sample_app/handler/handler.js, handler/advanceInvoiceSchedule.js, types/types.d.ts
Unsupported schedule types return HTTP 400, structured 4xx scheduling errors are returned, and other failures are thrown for retry handling.
Dunning subscription validation
sample-apps/.../dunning_cycle_end_handler_sample_app/handler/handler.js, types/types.d.ts
Invoices without subscriptions return HTTP 400; processing failures are thrown as transient errors. A matching HandlerResult contract is added.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Standardize platform errors versus application errors FRAMENGG-13161

Suggested reviewers: cb-gaganbankey

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Fails
🚫

ℹ️ CHANGELOG line 1 does not match the required format. Expected: JIRA_ISSUE_ID (TYPE_OF_CHANGE): SOME_MEANINGFUL_TITLE (GH_USER_HANDLE) [#PR_NUMBER] or JIRA link: https://mychargebee.atlassian.net/browse/<jiraId>. Got: "FRAMENGG-13161 support app error"

🚫

ℹ️ Please provide an AUTOMATION TEST REPORT URL in the PR description.

Messages
📖 👮 Hey cb-jananivijayan. Please address the failures to get this PR approved.

Generated by 🚫 dangerJS against f842415

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/handler/handler.js`:
- Around line 26-31: Update the handler’s scheduleAdvanceInvoice flow so
Chargebee 4xx failures from advanceInvoiceSchedule are propagated or converted
into a structured non-retryable response rather than completing without a
HandlerResult. Ensure the handler reports success only after scheduling
succeeds, while preserving transient-failure signaling for retryable errors.

In
`@sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/handler/handler.js`:
- Around line 16-24: Update the prevalidation around the handler’s subscription
lookup to match handleInvoiceUpdated: skip non-exhausted events before
validating, and resolve the subscription using invoice.subscription_id with
subscription.id as the fallback. Return the existing 400 response only when an
exhausted event has neither subscription identifier.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 67f2f917-e8d5-42d8-b3cd-fc9c0a7da7b5

📥 Commits

Reviewing files that changed from the base of the PR and between 862a50f and b3da232.

📒 Files selected for processing (7)
  • sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/handler/crmLead.js
  • sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/handler/handler.js
  • sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/types/types.d.ts
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/handler/handler.js
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/types/types.d.ts
  • sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/handler/handler.js
  • sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/types/types.d.ts

@cb-jananivijayan
cb-jananivijayan merged commit 046b18a into main Jul 31, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants