test: improve error handling tests