Correct exception throwing

RubyMine highlights incorrect lines (=
Merge pull request #274 from flash-gordon/patch-1

Correct exception throwing