updated tests to handle error object