chore: improve debugging experience (#3944)

This commit is contained in:
Sami Mazouz 2024-01-09 19:01:29 +01:00 committed by GitHub
parent 91b89bc698
commit c1be00e79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -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 {

View File

@ -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>

View File

@ -137,6 +137,12 @@ blockquote ol:last-child {
white-space: pre-wrap;
margin: 0;
}
&-iframe {
width: 100%;
max-height: 90vh;
border: 0;
}
}
#flarum-loading {