mirror of
https://github.com/flarum/framework.git
synced 2025-03-29 10:45:13 +08:00
chore: improve debugging experience (#3944)
This commit is contained in:
parent
91b89bc698
commit
c1be00e79a
framework/core
@ -604,7 +604,9 @@ export default class Application {
|
|||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.alert) {
|
if (e.status === 500 && isDebug) {
|
||||||
|
app.modal.show(RequestErrorModal, { error: e, formattedError: formattedErrors });
|
||||||
|
} else if (e.alert) {
|
||||||
this.requestErrorAlert = this.alerts.show(e.alert, e.alert.content);
|
this.requestErrorAlert = this.alerts.show(e.alert, e.alert.content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,6 +30,19 @@ export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAtt
|
|||||||
responseText = error.responseText;
|
responseText = error.responseText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (responseText?.includes('<script> Sfdump = window.Sfdump')) {
|
||||||
|
responseText = (
|
||||||
|
<iframe
|
||||||
|
srcdoc={responseText}
|
||||||
|
className="RequestErrorModal-iframe"
|
||||||
|
onload={(e: Event) => {
|
||||||
|
const iframe = e.target as HTMLIFrameElement;
|
||||||
|
iframe.style.height = (iframe.contentWindow?.document.body.offsetHeight || 0) + 50 + 'px';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="Modal-body">
|
<div className="Modal-body">
|
||||||
<pre>
|
<pre>
|
||||||
|
@ -137,6 +137,12 @@ blockquote ol:last-child {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-iframe {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 90vh;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#flarum-loading {
|
#flarum-loading {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user