From 291c39f59e958a012dd6e4ddec9b0276a4045b45 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 20 Aug 2012 15:44:25 -0400 Subject: [PATCH 1/1] Print an error before usage if we can't parse the page. --- src/Main.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 3ce1eef..1f6d7c5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -7,8 +7,11 @@ import System.Directory (doesFileExist) import System.IO ( Handle, IOMode (WriteMode), + hPutStrLn, openBinaryFile, - stdout) + stderr, + stdout + ) import CommandLine (show_help) import Configuration (Cfg(..), get_cfg) @@ -40,12 +43,14 @@ main = do cfg <- case aif of False -> get_login_cookie cfg' True -> return cfg' + page <- page_from_url cfg (article cfg) case page of Just p -> do output_handle <- get_output_handle (output cfg) epublish p output_handle Nothing -> do + hPutStrLn stderr "ERROR: could not parse an LWN page from the given URL." _ <- show_help return () -- 2.43.2