servo/rust-url — pull request #5 by seanmonstar (2014-07-31 23:46:36+00:00)
Title: use enum ParseError for errors instead of strings

Strings make things harder. When trying to decide if my error_handler should eat the error or not, the compiler won't notice if I typo an error message. And if the message changes, the compiler won't warn me about a non-existent enum variant.

With an enum, I can match for certains errors. I made the Show implementation mirror the text of the errors from before, in case they were used to show in a Browser Console or something. This also allows for the messages to be adjusted slightly, while leaving the variant alone.