diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-08-13 13:33:28 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-08-13 13:33:28 +0200 |
commit | b3ec0b60c5b4911d048db84cec92fdee5ee7b9a5 (patch) | |
tree | 8e58b77b585db8b0457320725ca02bdbac96344e /tests/fetcher | |
parent | f4e9d771337a7e7c72b74af4d0b3346c7428e94c (diff) | |
download | crawler-b3ec0b60c5b4911d048db84cec92fdee5ee7b9a5.tar.gz crawler-b3ec0b60c5b4911d048db84cec92fdee5ee7b9a5.tar.bz2 |
added test for lastErrMsg in fetcher
Diffstat (limited to 'tests/fetcher')
-rwxr-xr-x | tests/fetcher/test1.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/fetcher/test1.cpp b/tests/fetcher/test1.cpp index 9e5502d..0355500 100755 --- a/tests/fetcher/test1.cpp +++ b/tests/fetcher/test1.cpp @@ -70,6 +70,17 @@ int main( int argc, char *argv[] ) URL url = normalizer.parseUrl( urlString ); RewindInputStream *s = fetcher->fetch( url ); + if( !s->good( ) ) { + cerr << "Failed to fetch '" << url << "': " << s->lastErrMsg( ) << endl; + delete s; +#ifdef USE_MODULELOADER + fetchers.destroy( fetcher ); +#else + delete fetcher; +#endif + return 1; + } + copy_stream( *s, cout ); // s->rewind( ); // copy_stream( *s, cout ); |