From c32f6e6f1cf8b5230c2d836d654534c1b6ef64ce Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jul 2026 12:13:07 +0530 Subject: [PATCH 1/3] bump version v1.4.10 Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 3 +++ README.md | 2 +- pom.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0906974d..5874bc61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Version 1.4.10 - 2026-07-29 +* feat: expose structured API error data in RazorpayException + ## Version 1.4.9 - 2026-06-09 * fix: use random nonce per call in AES-GCM onboarding signature diff --git a/README.md b/README.md index e0f0110c..22c09af4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this dependency to your project's POM: com.razorpay razorpay-java - 1.4.9 + 1.4.10 ``` diff --git a/pom.xml b/pom.xml index a7b20c13..94240c6f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.razorpay razorpay-java - 1.4.9 + 1.4.10 jar razorpay-java From 3944607b8f6ac0567ed9c407d5a6d12fbca143ac Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jul 2026 12:16:17 +0530 Subject: [PATCH 2/3] docs: add Error Handling section with RazorpayException snippet Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 22c09af4..d8c36159 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,26 @@ Map headers = new HashMap(); razorpayClient.addHeaders(headers); ``` +## Error Handling + +SDK calls throw `RazorpayException` on API errors. In addition to the message, you can access structured error data returned by the API: + +```java +try { + Order order = razorpayClient.orders.create(orderRequest); +} catch (RazorpayException e) { + int httpStatus = e.getStatusCode(); // HTTP status code (e.g. 400) + String code = e.getCode(); // e.g. "BAD_REQUEST_ERROR" + String description = e.getDescription(); // human-readable message + String field = e.getField(); // offending field, if any + String reason = e.getReason(); + String source = e.getSource(); + String step = e.getStep(); + JSONObject metadata = e.getMetadata(); + JSONObject raw = e.getErrorResponse(); // full error JSON +} +``` + ## Supported Resources - [Addon](documents/addon.md) From 619421d1ff2127a079b6625d8f217627847c9093 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jul 2026 12:17:41 +0530 Subject: [PATCH 3/3] docs: expand v1.4.10 changelog entry with details Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5874bc61..35474f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Changelog ## Version 1.4.10 - 2026-07-29 -* feat: expose structured API error data in RazorpayException +* feat: expose structured API error data in `RazorpayException` + * `ApiClient` now parses the API error body and attaches it to the exception, so callers no longer need to parse the response themselves + * New getters on `RazorpayException`: `getCode()`, `getDescription()`, `getField()`, `getReason()`, `getSource()`, `getStep()`, `getMetadata()`, and `getErrorResponse()` for the full error JSON + * `getStatusCode()` returns the HTTP status code from the failed response + * Backwards compatible: existing constructors and `getMessage()` behavior are unchanged ## Version 1.4.9 - 2026-06-09 * fix: use random nonce per call in AES-GCM onboarding signature