#305: fix bugs and type anotations

This commit is contained in:
SleepWalker 2017-08-20 19:11:01 +03:00
parent 42399ef9bf
commit d0a356050f
3 changed files with 5 additions and 3 deletions

View File

@ -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();

View File

@ -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';

View File

@ -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) {