error logic update, added unit tests for errors
error logic update, added unit tests for errors