Use error object for exceptions

When throwing an exception just by string, then `stack` is not available.
Merge pull request #54 from tenbits/patch-1

Use error object for exceptions