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()); .then(blob => blob.arrayBuffer());
} }
function getErrorPageData(error: string, site?: GetSiteResponse) { function getErrorPageData(error: Error, site?: GetSiteResponse) {
const errorPageData: ErrorPageData = {}; const errorPageData: ErrorPageData = {};
// Exact error should only be seen in a development environment. Users if (site) {
// in production will get a more generic message. errorPageData.error = error.message;
if (process.env.NODE_ENV === "development") {
errorPageData.error = error;
} }
const adminMatrixIds = site?.admins const adminMatrixIds = site?.admins

View File

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