Handle misformatted versions with a nicer error message.

Fixes https://github.com/rust-lang/cargo/issues/61.
I think this pattern will become quite common in Rust code.