When an unexpected cardinality occurs (see Issue #15 ), this should best be logged right away. (As I attemt in pullrequest #21 .) The problem here is that it's hard to print a reasonable warning message within _handle_subfields_cardinality_max_one(), because there we only have an array of Subfields (which we expect to be max. 1 long), but no information on what field we're in or what the subfield identifier is.
I see two options:
Throwing an exception, which we handle where _handle_subfields_cardinality_max_one() was called.
we pass field-number and subfield-identifier to _handle_subfields_cardinality_max_one(), so we have al necessary information within this method.
@tobiasschweizer What say you? Wich option would you prefer?
When an unexpected cardinality occurs (see Issue #15 ), this should best be logged right away. (As I attemt in pullrequest #21 .) The problem here is that it's hard to print a reasonable warning message within
_handle_subfields_cardinality_max_one()
, because there we only have an array of Subfields (which we expect to be max. 1 long), but no information on what field we're in or what the subfield identifier is.I see two options:
_handle_subfields_cardinality_max_one()
was called._handle_subfields_cardinality_max_one()
, so we have al necessary information within this method.@tobiasschweizer What say you? Wich option would you prefer?