Fix set logic to check for error code on failure.

When data.set fails, currently it's currently not actually updating the default error code causing it to look as if the target LMS is failing to set data, but then returning a "No Error" code anyhow.