1
0
Fork 0

Merge pull request #3304 from BenJamesBen/error-stack-fix

fix(core): Improve error messages for Firefox and Safari browsers
This commit is contained in:
Enoch Riese 2023-01-11 17:30:13 -06:00 committed by GitHub
commit 31fbffd840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,16 @@ import Markdown from 'react-markdown'
import { formatMm } from 'shared/utils'
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>
{err.stack
{stack
.split(/\n/g)
.slice(0, 5)
.map((l, i) => (
@ -16,7 +23,8 @@ export const Error = ({ err }) => (
</code>
))}
</pre>
)
)
}
// Markdown wrapper to suppress creation of P tags
const Md = ({ children }) => (
@ -97,8 +105,6 @@ const StoreLogs = ({ logs, units }) => (
)
const Logs = (props) => {
const renderProps = props.draft.getRenderProps()
return (
<Tabs
tabs={[