on master help sign in
Merge pull request #29 from obsidiansystems/ryantrinkle/make-hub-optional

Make `getHubAuth` fail silently if the file doesn't exist

commit4694a92c493fd6d446d0439e18323e3d4452c7f9 authorRyan Trinkle <ryan.trinkle@gmail.com> dateSun 27 May 2018, 17:01 (8 years ago) parent2c580226ce93d5
1 file changed+3−3
lib/command/src/Obelisk/Command/Thunk.hs+3−3
lib/command/src/Obelisk/Command/Thunk.hs+3−3
@@ -497,9 +497,9 @@ getHubAuth
497497 -> IO (Maybe Auth)
498498getHubAuth domain = do
499499 hubConfig <- getXdgDirectory XdgConfig "hub"
500− Yaml.decodeFile hubConfig >>= \case
501− Nothing -> return Nothing
502− Just v -> return $ flip parseMaybe v $ \v' -> do
500+ Yaml.decodeFileEither hubConfig >>= \case
501+ Left _ -> return Nothing
502+ Right v -> return $ flip parseMaybe v $ \v' -> do
503503 Yaml.Array domainConfigs <- v' .: domain --TODO: Determine what multiple domainConfigs means
504504 [Yaml.Object domainConfig] <- return $ toList domainConfigs
505505 token <- domainConfig .: "oauth_token"