Added error codes to all errors and updated test suite