Added error code handling from error result. Will now supply correct error type.
Merge pull request #1 from RaoH/master

Added error code handling from error result. Will now supply correct err...