jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Cleanup all exception messages to be more consistent. #324

Closed jejacks0n closed 9 years ago

jejacks0n commented 9 years ago

There's kinda all over the place, and I've seen a pattern recently that I kinda like. Right now we usually generate the exception message in the same place where we call it, and that feels a little wrong.

I'd like to go through and remove all places where we raise Teaspoon::CustomException, "message", and just pass in the things that the message might need at the time that we raise them. This should consolidate all the exception messages into exceptions.rb.

At the same time, I'd like to restructure the phrasing of most of them to this sort of pattern: "Unknown version: expected a valid version for jasmine, which allows [1.0.0, 2.0.0]."

mikepack commented 9 years ago

What would the API look like when we want to raise a custom exception?

jejacks0n commented 9 years ago

We just need to move as much of the messaging to the exception classes themselves (in exceptions.rb). I'm happy to take this on too.

jejacks0n commented 9 years ago

Done in fd7d4442d90fb1982f08efe2cc32e96c1ed69fea