Filing this as a bug, because needlessly unfriendly developer experience should be treated as such.
When a field update attempts to change the field type (which can happen quite often with a Features development workflow), it fails. Drupal could easily say *which* field attempted to change type, but currently doesn't bother.
The attached patch applies against Drupal 7 and likely does not use whatever method of nicely printing variables exception throwing methods should use, and it is only for the error message i needed more info from. But it should show how close at hand we have information we choose not to share with developers.
Comment | File | Size | Author |
---|---|---|---|
#27 | drupal-1231710-field_exceptions-27.patch | 1.23 KB | cs_shadow |
#24 | drupal-1231710-field_exceptions-24.patch | 1.85 KB | cs_shadow |
#21 | drupal-1231710-field_exceptions-21.patch | 1.89 KB | cs_shadow |
#19 | drupal-1231710-field_exceptions-19.patch | 1.87 KB | cs_shadow |
#16 | interdiff.txt | 1.03 KB | Hydra |
Comments
Comment #1
mradcliffeThis should follow catch's patch in #792716: More useful field exception message. Changed priority to minor to match as well.
Since that issue is committed and closed, perhaps this one should be changed to fix all Field exceptions instead of just one or two including FieldUpdateForbiddenException (and FieldValidationException?). Tests will also need to be updated.
Comment #2
klausiHere is a patch that fixes more of the useless exception messages. More messages are now run through t(), don't know if this is wanted. Also promoting the issue to "normal", as this is really an annoyance if you deal with many fields and have to guess which one is broken.
Let's see if and where the test cases need to be corrected.
Comment #3
xjm+1 to this. This should make troubleshooting a lot less painful.
Tagging as novice for the task of rerolling the Drupal 8.x patch on account of #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
If you need help rerolling this patch, you can come to core office hours or ask in #drupal-gitsupport on IRC.
Comment #4
kathyh CreditAttribution: kathyh commentedUpdate per #3
Comment #5
star-szrTagging for reroll.
Comment #6
dcam CreditAttribution: dcam commentedRerolled #4. The changes to list.module were removed. Its FieldUpdateForbiddenException debug message was changed in #1294264: FieldUpdateForbiddenException: Cannot update a list field - better debug info and subsequently migrated to options.module.
Comment #7
jthorson CreditAttribution: jthorson commented#6: field-exceptions-1231710-6.patch queued for re-testing.
Comment #8
jthorson CreditAttribution: jthorson commentedUpdating tags
Comment #9
dcam CreditAttribution: dcam commented#6: field-exceptions-1231710-6.patch queued for re-testing.
Comment #10
dcam CreditAttribution: dcam commented#6: field-exceptions-1231710-6.patch queued for re-testing.
Comment #12
dcam CreditAttribution: dcam commentedRerolled #6.
Comment #13
swentel CreditAttribution: swentel commentedMost of the exceptions are covered for now, but a still couple are still remaning. Note that we use format_string in exceptions, never t().
Comment #14
Hydra CreditAttribution: Hydra commentedChecked for not covered exceptions and tried to make reasonable changes.
Comment #15
swentel CreditAttribution: swentel commentedThis will probably not work as columns is an array - field_name should be good enough I think.
Comment #16
Hydra CreditAttribution: Hydra commentedOkay, I did the suggested change like discussed in IRC, thx! Thats great :)
Comment #17
martin107 CreditAttribution: martin107 commented3 line patch, is useful and still applies 1 jan 2014.
Comment #18
catchYes these are very annoying when you hit them.
Committed/pushed to 8.x, thanks!
Should be backported.
Comment #19
cs_shadow CreditAttribution: cs_shadow commentedBackported patch in #16 to 7.x.
Comment #21
cs_shadow CreditAttribution: cs_shadow commentedFixed errors for the patch in #19.
Comment #22
cs_shadow CreditAttribution: cs_shadow commentedComment #23
mradcliffeI know that in Drupal 8 format_string() is the correct function to use, but I am not sure if switching to using format_string() in Drupal 7 is appropriate.
The other FieldException in this code snippet still uses the translate function, t().
Should the patch maintain consistency with Drupal 7 or Drupal 8?
Comment #24
cs_shadow CreditAttribution: cs_shadow commentedAttaching patch that uses translate function t(), instead of format_string() to maintain consistency with D7 code.
Comment #25
mradcliffePatch looks ready to back port to me.
Comment #26
David_Rothstein CreditAttribution: David_Rothstein commentedI don't understand this string change; field_create_instance() creates instances (not fields), so the original one is correct, right?
Regarding the use of t(), I think the current codebase is inconsistent with regard to whether it's used in exception messages (and I'm not sure there is always a right answer). So for this issue I would suggest leaving each as is so as not to rock the boat and risk introducing any strange bugs with the language system + error handling, etc....
So basically, if it uses t() already continue to use it; if it doesn't use t() already but needs placeholders, use format_string().
Comment #27
cs_shadow CreditAttribution: cs_shadow commented- Don't recall why I made that string change. Original one surely looks correct. Reverted back to original.
- Used format_string() since originally it wasn't using t() function. Though IMO, use of t() shouldn't break anything because other exception messaged are already using it.
Let me know if we can change it back to t().
Comment #28
filijonka CreditAttribution: filijonka commentedexceptions should never be translated so there is no reason to use t()
Comment #30
David_Rothstein CreditAttribution: David_Rothstein commentedComment #31
filijonka CreditAttribution: filijonka commentedwell we can't set a patch to rtbc that is failing on tests. probably needs a reroll is my guess but haven't time to check it.
Comment #32
amitgoyal CreditAttribution: amitgoyal commentedI tested the patch in #27 locally with the test "Search simplify" as it was failing on live. It worked fine for me.
Comment #33
filijonka CreditAttribution: filijonka commented27: drupal-1231710-field_exceptions-27.patch queued for re-testing.
ok so if it works locally let's just do a retest so we know if it is working or not.
Comment #34
filijonka CreditAttribution: filijonka commentedper #30
Comment #39
dcam CreditAttribution: dcam commentedComment #42
dcam CreditAttribution: dcam commentedComment #45
dcam CreditAttribution: dcam commentedComment #46
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks!