Wouldn't it make more sense to explicitly test for the string case, then fail on unrecognised input?