Browse Source

Merge pull request #678 from gre/always-show-errors

Always show error in the RenderError
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
361e381600
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      src/components/RenderError.js
  2. 1
      src/renderer/init.js

32
src/components/RenderError.js

@ -10,12 +10,10 @@ import hardReset from 'helpers/hardReset'
import type { T } from 'types/common' import type { T } from 'types/common'
import Spoiler from 'components/base/Spoiler'
import ExportLogsBtn from 'components/ExportLogsBtn' import ExportLogsBtn from 'components/ExportLogsBtn'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Space from 'components/base/Space' import Space from 'components/base/Space'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import TranslatedError from './TranslatedError'
type Props = { type Props = {
error: Error, error: Error,
@ -94,17 +92,23 @@ ${error.stack}
{t('app:crash.reset')} {t('app:crash.reset')}
</Button> </Button>
</Box> </Box>
<Space of={20} /> <Box my={6}>
<Spoiler color="wallet" title={t('app:crash.showError')}>
<ErrContainer> <ErrContainer>
<TranslatedError error={error} /> <strong>{String(error)}</strong>
<div>{error.stack || 'no stacktrace'}</div>
</ErrContainer> </ErrContainer>
</Spoiler> </Box>
<Space of={10} /> <pre
<Spoiler color="wallet" title={t('app:crash.showDetails')}> style={{
<ErrContainer>{error.stack}</ErrContainer> position: 'fixed',
</Spoiler> bottom: 8,
<Space of={100} /> left: 8,
opacity: 0.2,
fontSize: 10,
}}
>
{__APP_VERSION__}
</pre>
{children} {children}
</Box> </Box>
) )
@ -114,14 +118,14 @@ ${error.stack}
const ErrContainer = ({ children }: { children: any }) => ( const ErrContainer = ({ children }: { children: any }) => (
<pre <pre
style={{ style={{
marginTop: 10, margin: 'auto',
maxWidth: '80%', maxWidth: '80vw',
overflow: 'auto', overflow: 'auto',
fontSize: 10, fontSize: 10,
fontFamily: 'monospace', fontFamily: 'monospace',
background: 'rgba(0, 0, 0, 0.05)',
cursor: 'text', cursor: 'text',
userSelect: 'text', userSelect: 'text',
opacity: 0.3,
}} }}
> >
{children} {children}

1
src/renderer/init.js

@ -98,7 +98,6 @@ function r(Comp) {
} }
init().catch(e => { init().catch(e => {
// for now we make the app crash instead of pending forever. later we can render the error OR try to recover, but probably this is unrecoverable cases.
logger.critical(e) logger.critical(e)
r(<AppError error={e} language="en" />) r(<AppError error={e} language="en" />)
}) })

Loading…
Cancel
Save