Skip to content

Commit

Permalink
✨ Add bug report utility when DEBUG is open and application crashed.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkChenYutian committed Jul 25, 2022
1 parent feebc60 commit dce4972
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion src/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class C0VMApplication extends React.Component<{}, C0VMApplication
}

render() {
if (this.state.crashed) {
if (this.state.crashed && !globalThis.DEBUG) {
return <Result
status="error"
title="Application Crashed"
Expand All @@ -44,6 +44,57 @@ export default class C0VMApplication extends React.Component<{}, C0VMApplication
</button>
}
/>
} else if (this.state.crashed && globalThis.DEBUG) {
return <Result
status="error"
title="Application Crashed (Debug Mode)"
subTitle={<p>Please report this problem to our GitHub Repo!</p>}
extra={
<>
<button
className="base-btn main-btn"
onClick={() => {
globalThis.EDITOR_HIGHLIGHT_LINENUM = 0;
this.setState({crashed: false, C0Runtime: undefined, PrintoutValue: ""});
}}
>
Restore Editor Content
</button>
<div style={{textAlign: "left"}}>
<h3>How to report?</h3>
<h4>Step 1</h4>
<p>Copy the application status dump below: </p>
<pre id={globalThis.UI_PRINTOUT_ID}>{
JSON.stringify(
{
ReactState: this.state,
GlobalState: {
exec_line: globalThis.EDITOR_HIGHLIGHT_LINENUM,
breakpoints: Array.from(globalThis.EDITOR_BREAKPOINTS),
configuration: {
DEBUG: globalThis.DEBUG,
DEBUG_DUMP_MEM: globalThis.DEBUG_DUMP_MEM,
DEBUG_DUMP_STEP: globalThis.DEBUG_DUMP_STEP,
MEM_POOL_SIZE: globalThis.MEM_POOL_SIZE,
}
}
}, undefined, 4
)
}</pre>

<h4>Step 2</h4>
<p>
Open a new issue and paste the state dump above into issue description.
</p>
<a href="https://github.com/MarkChenYutian/C0VM-ts/issues" target="_blank" rel="noreferrer">
<button className="base-btn main-btn">
Open a New Issue
</button>
</a>
</div>
</>
}
/>
}
return (
<div className="page-framework">
Expand Down

0 comments on commit dce4972

Please sign in to comment.