Skip to content

fix: try to log response content even if not JSON#3787

Merged
sagarvora merged 1 commit intoresilient-tech:developfrom
sagarvora:log-response-text
Nov 12, 2025
Merged

fix: try to log response content even if not JSON#3787
sagarvora merged 1 commit intoresilient-tech:developfrom
sagarvora:log-response-text

Conversation

@sagarvora
Copy link
Copy Markdown
Member

@sagarvora sagarvora commented Nov 12, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved error logging for API responses, ensuring diagnostic information including response status and content is properly captured even when responses cannot be parsed as JSON format, enabling better troubleshooting and debugging capabilities.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The change adds initialization of the response variable to None and introduces conditional logging in the finally block to capture non-JSON or unparsable HTTP responses, ensuring output is logged even when response parsing fails.

Changes

Cohort / File(s) Summary
API Response Logging Enhancement
india_compliance/gst_india/api_classes/base.py
Initialize response variable to None in _make_request method; add fallback logging in finally block to output HTTP status code and text content when response exists but cannot be parsed as JSON

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

  • Minor initialization and defensive logging enhancement in a single file
  • Low logic density with straightforward null-checking pattern
  • Limited scope with clear intent to improve error observability

Poem

🐰 A response that's lost in translation,
No JSON, just confusion and frustration!
But now we log what's left behind,
The status and the text combined—
No silent failures, all eyes aligned! 🔍

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a29b900 and 8344a2e.

📒 Files selected for processing (1)
  • india_compliance/gst_india/api_classes/base.py (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sagarvora sagarvora merged commit d5c8bc2 into resilient-tech:develop Nov 12, 2025
5 of 10 checks passed
@sagarvora sagarvora deleted the log-response-text branch November 12, 2025 06:34
mergify Bot pushed a commit that referenced this pull request Nov 12, 2025
mergify Bot pushed a commit that referenced this pull request Nov 12, 2025
sagarvora added a commit that referenced this pull request Nov 12, 2025
…tfix/pr-3787

fix: try to log response content even if not JSON (backport #3787)
sagarvora added a commit that referenced this pull request Nov 12, 2025
…tfix/pr-3787

fix: try to log response content even if not JSON (backport #3787)
india-compliance-bot added a commit that referenced this pull request Nov 21, 2025
# [14.34.0](v14.33.2...v14.34.0) (2025-11-21)

### Bug Fixes

* add company and is_group filter to "default_gst_expense_account" search query ([b2f21a8](b2f21a8))
* try to log response content even if not JSON ([#3787](#3787)) ([47bbb69](47bbb69))

### Features

* enable total row addition in Bill of Entry Summary report ([45380f7](45380f7))
india-compliance-bot added a commit that referenced this pull request Nov 21, 2025
# [15.24.0](v15.23.2...v15.24.0) (2025-11-21)

### Bug Fixes

* add company and is_group filter to "default_gst_expense_account" search query ([27f9ba6](27f9ba6))
* add deduplication option to job enqueue ([e840a83](e840a83))
* allow first and last name for both types of parties ([a6b5b43](a6b5b43))
* first and last name field in party quick entry form ([3e98297](3e98297))
* **gst-ims:** enhance download job handling with job ID and alert for ongoing jobs ([93b8b58](93b8b58))
* **ims:** also fetch original_bill_date and original_bill_no fields in Inward Supply ([224586c](224586c))
* make hash only from gstin and return type ([4023404](4023404))
* **purchase-reco:** add alert for ongoing download jobs ([216ae41](216ae41))
* **purchase-reco:** give job_id argument to frappe.enqueue ([ddda861](ddda861))
* **purchase-reco:** use optional chaining for message handling in download_gstr function ([b986ea2](b986ea2))
* remove unused hash generation function ([4ca5300](4ca5300))
* try to log response content even if not JSON ([#3787](#3787)) ([876a935](876a935))

### Features

* ability to specify Origin Port / Border Checkpost Address for the purpose of e-Waybill in delivery note ([e386068](e386068))
* enable total row addition in Bill of Entry Summary report ([ebe21b2](ebe21b2))
sameer8848digital pushed a commit to 8848digital/india_compliance that referenced this pull request Dec 16, 2025
sameer8848digital pushed a commit to 8848digital/india_compliance that referenced this pull request Dec 16, 2025
* add company and is_group filter to "default_gst_expense_account" search query ([27f9ba6](resilient-tech@27f9ba6))
* add deduplication option to job enqueue ([e840a83](resilient-tech@e840a83))
* allow first and last name for both types of parties ([a6b5b43](resilient-tech@a6b5b43))
* first and last name field in party quick entry form ([3e98297](resilient-tech@3e98297))
* **gst-ims:** enhance download job handling with job ID and alert for ongoing jobs ([93b8b58](resilient-tech@93b8b58))
* **ims:** also fetch original_bill_date and original_bill_no fields in Inward Supply ([224586c](resilient-tech@224586c))
* make hash only from gstin and return type ([4023404](resilient-tech@4023404))
* **purchase-reco:** add alert for ongoing download jobs ([216ae41](resilient-tech@216ae41))
* **purchase-reco:** give job_id argument to frappe.enqueue ([ddda861](resilient-tech@ddda861))
* **purchase-reco:** use optional chaining for message handling in download_gstr function ([b986ea2](resilient-tech@b986ea2))
* remove unused hash generation function ([4ca5300](resilient-tech@4ca5300))
* try to log response content even if not JSON ([resilient-tech#3787](resilient-tech#3787)) ([876a935](resilient-tech@876a935))

* ability to specify Origin Port / Border Checkpost Address for the purpose of e-Waybill in delivery note ([e386068](resilient-tech@e386068))
* enable total row addition in Bill of Entry Summary report ([ebe21b2](resilient-tech@ebe21b2))
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.

1 participant