2018-09-03 16:17:36 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import ErrorNotification from "./ErrorNotification";
|
2019-02-27 10:45:10 +01:00
|
|
|
import { BackendError } from "./errors";
|
2018-09-03 16:17:36 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
error: Error,
|
|
|
|
|
title: string,
|
|
|
|
|
subtitle: string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ErrorPage extends React.Component<Props> {
|
|
|
|
|
render() {
|
2019-02-27 10:45:10 +01:00
|
|
|
const { title, error } = this.props;
|
2018-09-03 16:17:36 +02:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<section className="section">
|
|
|
|
|
<div className="box column is-4 is-offset-4 container">
|
|
|
|
|
<h1 className="title">{title}</h1>
|
2019-02-27 10:45:10 +01:00
|
|
|
{this.renderSubtitle()}
|
2018-09-03 16:17:36 +02:00
|
|
|
<ErrorNotification error={error} />
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|
2019-02-27 10:45:10 +01:00
|
|
|
|
|
|
|
|
renderSubtitle = () => {
|
|
|
|
|
const { error, subtitle } = this.props;
|
|
|
|
|
if (error instanceof BackendError) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return <p className="subtitle">{subtitle}</p>
|
|
|
|
|
}
|
2018-09-03 16:17:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ErrorPage;
|