trc-client-core
Version:
The core of the TRC Client
20 lines (15 loc) • 438 B
JavaScript
import {INTERNAL_SERVER_ERROR} from 'trc-client-core/src/constants/Error';
export default function PromiseErrorHandler(err) {
if(!err) {
return Promise.reject(INTERNAL_SERVER_ERROR);
}
// Error Code Sideeffects
switch (err.status) {
case 401:
if(window.location.pathname !== "/") {
window.location = "/";
}
break;
}
return Promise.reject(err);
}