mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Make error code always display
This commit is contained in:
parent
fe69f8ee5f
commit
83fc9f3949
2 changed files with 4 additions and 11 deletions
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue