Merge pull request #3304 from BenJamesBen/error-stack-fix
fix(core): Improve error messages for Firefox and Safari browsers
This commit is contained in:
commit
31fbffd840
1 changed files with 23 additions and 17 deletions
|
@ -2,9 +2,16 @@ import Markdown from 'react-markdown'
|
||||||
import { formatMm } from 'shared/utils'
|
import { formatMm } from 'shared/utils'
|
||||||
import { Tab, Tabs } from '../mdx/tabs.js'
|
import { Tab, Tabs } from '../mdx/tabs.js'
|
||||||
|
|
||||||
export const Error = ({ err }) => (
|
export const Error = ({ err }) => {
|
||||||
|
// Include the error name and message info if it isn't already at the top
|
||||||
|
// of the error stack.
|
||||||
|
let stack = err.stack
|
||||||
|
if (!err.stack.startsWith(err.toString())) {
|
||||||
|
stack = err.toString() + '\n' + err.stack
|
||||||
|
}
|
||||||
|
return (
|
||||||
<pre>
|
<pre>
|
||||||
{err.stack
|
{stack
|
||||||
.split(/\n/g)
|
.split(/\n/g)
|
||||||
.slice(0, 5)
|
.slice(0, 5)
|
||||||
.map((l, i) => (
|
.map((l, i) => (
|
||||||
|
@ -16,7 +23,8 @@ export const Error = ({ err }) => (
|
||||||
</code>
|
</code>
|
||||||
))}
|
))}
|
||||||
</pre>
|
</pre>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Markdown wrapper to suppress creation of P tags
|
// Markdown wrapper to suppress creation of P tags
|
||||||
const Md = ({ children }) => (
|
const Md = ({ children }) => (
|
||||||
|
@ -97,8 +105,6 @@ const StoreLogs = ({ logs, units }) => (
|
||||||
)
|
)
|
||||||
|
|
||||||
const Logs = (props) => {
|
const Logs = (props) => {
|
||||||
const renderProps = props.draft.getRenderProps()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs
|
<Tabs
|
||||||
tabs={[
|
tabs={[
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue