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
...@@ -25,7 +25,7 @@ test: ...@@ -25,7 +25,7 @@ test:
script: script:
# find 0.14.2 purescript version here: # find 0.14.2 purescript version here:
# https://lazamar.co.uk/nix-versions/ # 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 git
- nix-env -i nodejs - nix-env -i nodejs
- nix-env -i yarn - nix-env -i yarn
......
...@@ -5,6 +5,7 @@ import Gargantext.Prelude ...@@ -5,6 +5,7 @@ import Gargantext.Prelude
import Data.Array as A import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (foldl) import Data.Foldable (foldl)
import Data.Maybe (fromMaybe)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
...@@ -41,7 +42,7 @@ handleErrorInAsyncProgress errors ap@(AsyncProgress { log, status: IsFinished }) ...@@ -41,7 +42,7 @@ handleErrorInAsyncProgress errors ap@(AsyncProgress { log, status: IsFinished })
handleErrorInAsyncProgress _ _ = pure unit handleErrorInAsyncProgress _ _ = pure unit
concatErrors :: AsyncProgress -> String concatErrors :: AsyncProgress -> String
concatErrors (AsyncProgress { log }) = foldl eventsErrorMessage "" log concatErrors (AsyncProgress { error, log }) = foldl eventsErrorMessage (fromMaybe "" error) log
where where
eventsErrorMessage acc (AsyncTaskLog { events }) = (foldl eventErrorMessage "" events) <> "\n" <> acc eventsErrorMessage acc (AsyncTaskLog { events }) = (foldl eventErrorMessage "" events) <> "\n" <> acc
eventErrorMessage acc (AsyncEvent { level: "ERROR", message }) = message <> "\n" <> acc eventErrorMessage acc (AsyncEvent { level: "ERROR", message }) = message <> "\n" <> acc
......
...@@ -736,8 +736,9 @@ derive newtype instance JSON.ReadForeign AsyncTaskWithType ...@@ -736,8 +736,9 @@ derive newtype instance JSON.ReadForeign AsyncTaskWithType
instance Eq AsyncTaskWithType where eq = genericEq instance Eq AsyncTaskWithType where eq = genericEq
newtype AsyncProgress = AsyncProgress newtype AsyncProgress = AsyncProgress
{ id :: AsyncTaskID { id :: AsyncTaskID
, log :: Array AsyncTaskLog , error :: Maybe String
, log :: Array AsyncTaskLog
, status :: AsyncTaskStatus , status :: AsyncTaskStatus
} }
derive instance Generic AsyncProgress _ 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