Most field exceptions tell you what exactly is wrong when something's wrong, these two still don't.

CommentFileSizeAuthor
#4 field_exception.patch1.4 KBcatch
field_exception.patch1.4 KBcatch

Comments

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
bjaspan’s picture

A quick grep reveals 77 instances of "throw new Foo(t(...))" and 136 instances of "throw new Foo(...)" (without t()), plus 7 throw new Foo(). It is not clear to me whether t() is right or not. I suspect core should be more consistent. Separate issue?

bjaspan’s picture

Perhaps a minor nit, but "Attempt to update an instance of a nonexistent field, @field" is incorrectly punctuated at least according to American English. Better would be:

* "Attempt to update an instance of nonexistent field @field", or
* "Attempt to update an instance of a nonexistent field: @field"

I see similar punctuation errors in Field module, I'm guessing from the same author. :-)

I'm just full of irrelevant suggestions tonight, eh?

catch’s picture

StatusFileSize
new1.4 KB

Removed the comma, I was using the "The Drupal 7 field API maintainer, Barry Jaspan" rule but that may only be for people.

t() in exceptions in field API appears to depend entirely on whether placeholders are used or not, that inconsistency wasn't introduced by me. In general I assume it depends on whether t() is available or not.

moshe weitzman’s picture

t() is always available in D7.

Having said that, I don't think we need to increase translator burden by including Exception strings. They are not supposed to be seen by devs and even then only in exceptional circumstances.

dries’s picture

I agree that we shouldn't translate exceptions. In general, exceptions are not meant to be output to the end-user.

dries’s picture

Status: Reviewed & tested by the community » Fixed

I committed the patch. We should create a new issue to deal with the t() situation. Thanks catch.

catch’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.