Make error code always display

This commit is contained in:
abias 2023-05-22 08:38:05 -04:00
parent fe69f8ee5f
commit 83fc9f3949
2 changed files with 4 additions and 11 deletions

View File

@ -294,13 +294,11 @@ async function fetchIconPng(iconUrl: string) {
.then(blob => blob.arrayBuffer());
}
function getErrorPageData(error: string, site?: GetSiteResponse) {
function getErrorPageData(error: Error, site?: GetSiteResponse) {
const errorPageData: ErrorPageData = {};
// Exact error should only be seen in a development environment. Users
// in production will get a more generic message.
if (process.env.NODE_ENV === "development") {
errorPageData.error = error;
if (site) {
errorPageData.error = error.message;
}
const adminMatrixIds = site?.admins

View File

@ -57,12 +57,7 @@ export class ErrorPage extends Component<any, any> {
</>
)}
{errorPageData?.error && (
<code
style={{ "text-align": "start" }}
className="d-block bg-dark text-light p-2 mt-4"
>
{errorPageData.error}
</code>
<strong className="d-block">Error Code: {errorPageData.error}</strong>
)}
</div>
);