diff --git a/src/Macroscope/Worker.hs b/src/Macroscope/Worker.hs index 74bfbd8ca..a6779de93 100644 --- a/src/Macroscope/Worker.hs +++ b/src/Macroscope/Worker.hs @@ -13,6 +13,7 @@ module Macroscope.Worker ( getStreamOldestEntity, ) where +import Data.Text.Lazy qualified as T import Data.Vector qualified as V import Google.Protobuf.Timestamp as Timestamp import Lentille @@ -128,7 +129,8 @@ processStream logFunc postFunc = go (0 :: Word) [] [] toCrawlerError (LentilleError ts err) = CrawlerError {..} where crawlerErrorCreatedAt = Just $ from ts - (crawlerErrorMessage, crawlerErrorBody) = case err of + crawlerErrorBody = T.take 4096 crawlerErrorBody' + (crawlerErrorMessage, crawlerErrorBody') = case err of DecodeError xs -> ("decode", encodeJSON xs) RequestError e -> ("graph", encodeJSON e) RateLimitInfoError e -> ("rate-limit-info", encodeJSON e) diff --git a/web/src/App.res b/web/src/App.res index 7a38d0dbc..1736e5b9b 100644 --- a/web/src/App.res +++ b/web/src/App.res @@ -293,9 +293,12 @@ module About = { module Errors = { module CrawlerError = { @react.component - let make = (~err: CrawlerTypes.crawler_error) => { + let make = (~crawler: CrawlerTypes.crawler_error_list, ~err: CrawlerTypes.crawler_error) => { + let entity: option = crawler.entity->Belt.Option.flatMap(Js.Json.stringifyAny)
getDate} /> +
{("entity: " ++ entity->Belt.Option.getWithDefault(""))->str}
+
{("crawler: " ++ crawler.crawler)->str}
{("message: " ++ err.message)->str}
{("body: " ++ err.body)->str}

@@ -303,18 +306,8 @@ module Errors = { } } - module CrawlerErrors = { - @react.component - let make = (~err: CrawlerTypes.crawler_error_list) => { - let entity: option = err.entity->Belt.Option.flatMap(Js.Json.stringifyAny) -
-
{("entity: " ++ entity->Belt.Option.getWithDefault(""))->str}
-
{("crawler: " ++ err.crawler)->str}
- {err.errors->Belt.List.map(e => )->Belt.List.toArray->React.array} -
-
- } - } + let getDateInt = mDate => + mDate->Belt.Option.getExn->Belt.Option.getExn->Js.Date.valueOf->Belt.Float.toInt @react.component let make = (~store: Store.t) => { @@ -324,7 +317,15 @@ module Errors = {

{"The following errors happened when updating the index. This is likely causing some data to be missing."->str}

- {state.errors->Belt.List.map(e => )->Belt.List.toArray->React.array} + {state.errors + ->Belt.List.map(crawler => crawler.errors->Belt.List.map(err => (crawler, err))) + ->Belt.List.flatten + ->Belt.List.sort(((_, err_a), (_, err_b)) => + err_b.created_at->getDateInt - err_a.created_at->getDateInt + ) + ->Belt.List.map(((crawler, err)) => ) + ->Belt.List.toArray + ->React.array} } }