make sure not to write past the k_error buffer
Merge pull request #10 from arnaud-lb/set-error

added set_error()