Commit 35bbbf08 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[async tasks] fix error reporting for async tasks, add 0.14.4 PS for CI

parent 1c46c74a
Pipeline #2290 failed with stage
......@@ -25,7 +25,7 @@ test:
script:
# find 0.14.2 purescript version here:
# https://lazamar.co.uk/nix-versions/
- nix-env -i purescript-0.14.2 -f https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz
- nix-env -i purescript-0.14.4 -f https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz
- nix-env -i git
- nix-env -i nodejs
- nix-env -i yarn
......
......@@ -5,6 +5,7 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Foldable (foldl)
import Data.Maybe (fromMaybe)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
......@@ -41,7 +42,7 @@ handleErrorInAsyncProgress errors ap@(AsyncProgress { log, status: IsFinished })
handleErrorInAsyncProgress _ _ = pure unit
concatErrors :: AsyncProgress -> String
concatErrors (AsyncProgress { log }) = foldl eventsErrorMessage "" log
concatErrors (AsyncProgress { error, log }) = foldl eventsErrorMessage (fromMaybe "" error) log
where
eventsErrorMessage acc (AsyncTaskLog { events }) = (foldl eventErrorMessage "" events) <> "\n" <> acc
eventErrorMessage acc (AsyncEvent { level: "ERROR", message }) = message <> "\n" <> acc
......
......@@ -736,8 +736,9 @@ derive newtype instance JSON.ReadForeign AsyncTaskWithType
instance Eq AsyncTaskWithType where eq = genericEq
newtype AsyncProgress = AsyncProgress
{ id :: AsyncTaskID
, log :: Array AsyncTaskLog
{ id :: AsyncTaskID
, error :: Maybe String
, log :: Array AsyncTaskLog
, status :: AsyncTaskStatus
}
derive instance Generic AsyncProgress _
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment