Adds error codes to exceptions.