Closed samseaver closed 12 years ago
I'll admit that the error message could be better constructed. My tests indicate that you're passing in undef
to the constructor, which will cause it to die. If you pass in an empty string it will simply return an empty string. If you pass in no value, it will return an empty string:
sub cpd { return ModelSEED::MS::Compound->new($_[0]) }
print cpd({ name => "" })->name; # prints ""
print cpd({})->name; # prints ""
print cpd({ name => undef })->name; # dies
I'm not sure what the correct behavior is if you pass in undef. Frankly the empty strings seems like the wrong way as well...more likely to confuse people than an undefined value. But I could go either way on this.
This indicates that the hash which stores the properties should have some defaults.
So, this really threw me for a while, and this is because the error message was actually wrong. I realized that I had a reaction for which there was no name available, but when running addrxntable, the error message I got was this:
so I was looking for a name that was too long. In any case, I think the simple case of an empty string being passed via a new() function needs to be handled properly.