mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 06:30:00 +05:30
#305: fix bugs and type anotations
This commit is contained in:
parent
42399ef9bf
commit
d0a356050f
@ -8,12 +8,12 @@ const ABORT_ERR = 20;
|
||||
|
||||
export default function BsodMiddleware(dispatchBsod: Function, logger: Logger) {
|
||||
return {
|
||||
catch(resp?: Resp|InternalServerError): Promise<Resp> {
|
||||
catch<T: Resp<*>|InternalServerError>(resp?: T): Promise<T> {
|
||||
if (resp && (
|
||||
(resp instanceof InternalServerError
|
||||
&& InternalServerError.error.code !== ABORT_ERR
|
||||
&& resp.error.code !== ABORT_ERR
|
||||
) || (resp.originalResponse
|
||||
&& /404|5\d\d/.test(resp.originalResponse.status)
|
||||
&& /404|5\d\d/.test((resp.originalResponse.status: string))
|
||||
)
|
||||
)) {
|
||||
dispatchBsod();
|
||||
|
@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
|
||||
import { Route, Switch, Redirect } from 'react-router-dom';
|
||||
|
||||
import logger from 'services/logger';
|
||||
import { browserHistory } from 'services/history';
|
||||
import { FooterMenu } from 'components/footerMenu';
|
||||
import Profile from 'components/profile/Profile';
|
||||
import ChangePasswordPage from 'pages/profile/ChangePasswordPage';
|
||||
|
@ -4,6 +4,7 @@ function InternalServerError(error: Error|string|Object, resp?: Response|Object)
|
||||
|
||||
this.name = 'InternalServerError';
|
||||
this.message = 'InternalServerError';
|
||||
this.error = error;
|
||||
this.stack = (new Error()).stack;
|
||||
|
||||
if (resp) {
|
||||
|
Loading…
Reference in New Issue
Block a user