Raise error objects instead of strings

Hi, made this to make error handling easier :)