summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-08-13 13:33:28 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-08-13 13:33:28 +0200
commitb3ec0b60c5b4911d048db84cec92fdee5ee7b9a5 (patch)
tree8e58b77b585db8b0457320725ca02bdbac96344e
parentf4e9d771337a7e7c72b74af4d0b3346c7428e94c (diff)
downloadcrawler-b3ec0b60c5b4911d048db84cec92fdee5ee7b9a5.tar.gz
crawler-b3ec0b60c5b4911d048db84cec92fdee5ee7b9a5.tar.bz2
added test for lastErrMsg in fetcher
-rw-r--r--docs/LINKS1
-rwxr-xr-xtests/fetcher/test1.cpp11
2 files changed, 12 insertions, 0 deletions
diff --git a/docs/LINKS b/docs/LINKS
index 8e5b042..9d9e6a5 100644
--- a/docs/LINKS
+++ b/docs/LINKS
@@ -31,6 +31,7 @@ http://www.makeuseof.com/tag/build-basic-web-crawler-pull-information-website/
Streams
http://www.mr-edd.co.uk/blog/beginners_guide_streambuf
+http://www.codeproject.com/Articles/4457/zipstream-bzip2stream-iostream-wrappers-for-the-zl
Lua embedding
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 );