Skip to content

Parallel requests and Exception handling #116

Open
@z0isch

Description

@z0isch

The program below logs the error when using 4.0.0, but when I upgrade to 5.0.0 it no longer logs the error

module Main where

import Prelude

import Control.Monad.Aff (Aff, launchAff)
import Control.Monad.Aff.Console (log, logShow)
import Control.Monad.Eff.Exception (EXCEPTION, error)
import Control.Monad.Error.Class (throwError, try)
import Control.Parallel (parallel, sequential)
import Data.Tuple (Tuple(..))
import Network.HTTP.Affjax (AJAX, get)

getPostbin :: forall eff.  Aff (exception :: EXCEPTION, ajax :: AJAX | eff) String
getPostbin = do
  resp <- get "http://postb.in/BgIt83CL"
  void $ throwError (error "Oops")
  pure resp.response

main = void $ launchAff do
    t <- try $ sequential $ Tuple <$> parallel getPostbin <*> parallel getPostbin
    logShow t

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions