RUBY-842 populate error code when using  write commands
Merge pull request #552 from estolfo/RUBY-842-error-code

RUBY-842 populate error code when using write commands