Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[symfony/mailjet-mailer] Fix invalid mailjet error managment #45564

Merged

Conversation

alamirault
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #45420
License MIT
Doc PR

When mailjet API status code is not 200, response is structured (see-below) and is not currently well managed.

Example of bad request response:

{
  "Messages": [
    {
      "Status": "error",
      "Errors": [
        {
          "ErrorIdentifier": "8e28ac9c-1fd7-41ad-825f-1d60bc459189",
          "ErrorCode": "mj-0005",
          "StatusCode": 400,
          "ErrorMessage": "The To is mandatory but missing from the input",
          "ErrorRelatedTo": ["To"]
        }
      ]
    }
  ]
}

This PR fix Undefined index: Message and add unit tests.

@carsonbot carsonbot added this to the 6.1 milestone Feb 26, 2022
@alamirault alamirault changed the base branch from 6.1 to 5.4 February 26, 2022 10:49
@alamirault alamirault changed the title Fix 45420 invalid mailjet error managment [symfony/mailjet-mailer] Fix invalid mailjet error managment Feb 26, 2022
@carsonbot
Copy link

Hey!

I think @tcheymol has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@fancyweb fancyweb modified the milestones: 6.1, 5.4 Mar 2, 2022
@alamirault alamirault requested a review from fancyweb March 6, 2022 20:41
@alamirault alamirault force-pushed the fix-45420-invalid-mailjet-error-managment branch from 5c0095a to e83abc2 Compare March 9, 2022 17:45
@alamirault alamirault requested a review from fancyweb March 9, 2022 17:53
@fabpot fabpot force-pushed the fix-45420-invalid-mailjet-error-managment branch from e83abc2 to aa1e12c Compare March 12, 2022 09:10
@fabpot
Copy link
Member

fabpot commented Mar 12, 2022

Thank you @alamirault.

@fabpot fabpot merged commit b7e878c into symfony:5.4 Mar 12, 2022
This was referenced Apr 2, 2022
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.

[symfony/mailjet-mailer] Error message is not processed correctly
4 participants