Handle type-check failure when calling generic function