Usability: FlushError: ambiguous/broken error message

Issue #2063 resolved
Former user created an issue

"FlushError: Attempting to flush an item of type X on collection Y, whose mapper does not inherit from that of Z."

It is not clear whether "whose mapper" means the mapper of collection Y or the item of type X (or type X). Similarly, "that" is ambiguous.

It should actually look like this (assuming I understood the error correctly now after some googling):

"FlushError: Attempting to flush an item of type X on collection Y, while the mapper of X does not inherit from the mapper of Z."

Comments (8)

  1. Mike Bayer repo owner

    I don't think the "that" is ambiguous, it means "the mapper of Z". "A, whose B does not C from that of D" - "that of D" means "the B of D".

    "whose" refers to X but I will agree the target on that element is ambiguous.

    If we're going to rewrite the sentence, might as well remove as much SQLAlchemy terminology as possible, so I'd propose "Attempting to flush an item of type X as a member of collection Y; but X is not a subclass of Z, the type of object stored by Y". Let me know if you approve.

  2. Mike Bayer repo owner

    correction, its technically possible that X extends Z but the mappers aren't set up that way (this is why these messages can become awkward). Plus there's still an implicit subject in there.

    "Attempting to flush an item of type X as a member of collection Y; but the mapper of X does not specify "inherits" from the mapper of Z, where Z is the type of object stored by Y"

  3. Former user Account Deleted

    "that" is ambiguous because it could also mean "whose mapper does not inherit from the collection of Z." or something else. (to someone who doesn't know what the error means at all and has to guess how it is all supposed to be put together - of course we know that this refers to the mapper of Z and not something else)

    But your suggestion sounds fine:

    "Attempting to flush an item of type X as a member of collection Y; but the mapper of X does not specify "inherits" from the mapper of Z, where Z is the type of object stored by Y"

    Even better than my suggestion due to the additional information about Z being usually stored by Y :)

  4. Log in to comment