-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
/
errors.js
61 lines (57 loc) · 1.78 KB
/
errors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react'
import Layout from '@theme/Layout'
import { useLocation } from '@docusaurus/router'
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
import styles from './styles.module.css'
import errorCodes from '../../../errors.json'
function Errors() {
const location = useLocation()
const context = useDocusaurusContext()
const { siteConfig = {} } = context
const errorCode = new URLSearchParams(location.search).get('code')
const error = errorCodes[errorCode]
return (
<Layout
title={`${siteConfig.title} - A JS library for predictable global state management`}
description="A JS library for predictable global state management"
>
<main className={styles.mainFull}>
<h1>Production Error Codes</h1>
<p>
When Redux is built and running in production, error text is replaced
by indexed error codes to save on bundle size. These errors will
provide a link to this page with more information about the error
below.
</p>
{error && (
<React.Fragment>
<p>
<strong>
The full text of the error you just encountered is:
</strong>
</p>
<code className={styles.errorDetails}>{error}</code>
</React.Fragment>
)}
<h2>All Error Codes</h2>
<table>
<thead>
<tr>
<th>Code</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{Object.keys(errorCodes).map(code => (
<tr>
<td>{code}</td>
<td>{errorCodes[code]}</td>
</tr>
))}
</tbody>
</table>
</main>
</Layout>
)
}
export default Errors