I don't particularly see how this failed test can be measured on a scale of optimal outcomes. A failed test means North Korea has test feedback, and will improve the missile so the next one is successful. A successful test means that North Korea is already at that point. The difference in time between the two states of having a proven missile and having one that is close to proven but needs some bug fixing is likely much shorter than any possible military action towards North Korea - which likely would be disastrous, regardless of whether North Korea had this missile working or not.
There needs to be a solution, but I don't see how that could ever be a military one, here. And the impact of this missile test's result is plausibly negligible - I don't think that Trump has to consider any different a scenario because this missile failed.