nteract / ansi-to-react

:guardsman: ANSI to React
88 stars 31 forks source link

Runtime failure when trying to enable Ansi blocks #33

Open ssbarnea opened 4 years ago

ssbarnea commented 4 years ago

Why trying to enable <Ansi> via https://review.opendev.org/#/c/716251/4/web/src/containers/build/BuildOutput.jsx I observed that this produces failures like https://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_aa6/716251/4/check/zuul-build-dashboard/aa6b67f/npm/html/build/f88a6e20be834d5a8245b5473e609a8e

TypeError: "e.split is not a function"
    value index.js:291
    value index.js:251
    value index.js:99
    default index.js:28
    default index.js:115
    React 6
    unstable_runWithPriority scheduler.production.min.js:19
    React 6
    Redux 7
    N build.js:280
react-dom.production.min.js:209:194
    React 5
    unstable_runWithPriority scheduler.production.min.js:19
    React 4
    unstable_runWithPriority scheduler.production.min.js:19
    React 6
    Redux 7
    N build.js:280

This error happens only on this proposed change so it should have something to so with how I tried to use it.

captainsafia commented 4 years ago

The ansi-to-react package uses the split method here.

Typically, this error will occur if no children are passed to the ansi-to-react component or no valid contents are parsed. I would confirm that the data based is valid.

Regardless, we should probably add a try-catch around the code referenced above so that errors like this don't happen.