8000 minor #47628 [Mime] Improve error message on invalid form field (dung… · symfony/symfony@4d09837 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d09837

Browse files
committed
minor #47628 [Mime] Improve error message on invalid form field (dunglas)
This PR was merged into the 6.2 branch. Discussion ---------- [Mime] Improve error message on invalid form field | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a Currently, when you forget to set the subject of a mail, you get a weird error that is hard to debug. This patch improves the error message. Commits ------- 77d5798 [Mime] Improve error message on invalid form field
2 parents 35300c4 + 77d5798 commit 4d09837

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(array $fields = [])
3434

3535
foreach ($fields as $name => $value) {
3636
if (!\is_string($value) && !\is_array($value) && !$value instanceof TextPart) {
37-
throw new InvalidArgumentException(sprintf('A form field value can only be a string, an array, or an instance of TextPart ("%s" given).', get_debug_type($value)));
37+
throw new InvalidArgumentException(sprintf('The value of the form field "%s" can only be a string, an array, or an instance of TextPart ("%s" given).', $name, get_debug_type($value)));
3838
}
3939

4040
$this->fields[$name] = $value;

0 commit comments

Comments
 (0)
0