mirror of
https://github.com/flarum/framework.git
synced 2025-03-24 07:35:14 +08:00
chore: improve debugging experience (#3944)
This commit is contained in:
parent
91b89bc698
commit
c1be00e79a
@ -604,7 +604,9 @@ export default class Application {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
|
@ -30,6 +30,19 @@ export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAtt
|
||||
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 (
|
||||
<div className="Modal-body">
|
||||
<pre>
|
||||
|
@ -137,6 +137,12 @@ blockquote ol:last-child {
|
||||
white-space: pre-wrap;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&-iframe {
|
||||
width: 100%;
|
||||
max-height: 90vh;
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#flarum-loading {
|
||||
|
Loading…
x
Reference in New Issue
Block a user