Skip to content

Conversation

@fabidick22
Copy link

Issue #, if available:

Description of changes:
Enhances error logging in the image validation process by including the source URL in error messages when image format validation fails. This significantly improves debugging experience by providing immediate context about which image caused the failure.

Motivation:
Previously, when an image validation error occurred, the error logs did not include the URL of the problematic image, so you needed:

  1. Find the error log with the requestId
  2. Search through multiple log entries to find other logs with the same requestId
  3. Locate the URL from those related logs

Changes:

  • Modified validateImageMagicNumbers to accept optional url parameter
  • Updated all error messages within the method to include URL context
  • Added and updated tests to cover this refactor

Example output:
Before:

{
  "errorType": "InvalidImage",
  "clientMessage": "Content-Type image/png does not match detected format jpeg"
}

After:

{
  "errorType": "InvalidImage",
  "clientMessage": "Content-Type image/png does not match detected format jpeg from: https://example.com/image.png"
}

Checklist

  • 👋 I have added unit tests for all code changes.
  • 👋 I have run the unit tests, and all unit tests have passed.
  • ⚠️ This pull request might incur a breaking change.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@gsingh04 gsingh04 requested a review from bryceaug December 4, 2025 19:07
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.

1 participant