import { To } from 'react-router' ; class RedirectError extends Error { statusCode : number = 302 ; to : To = '' ; name : string = 'RedirectError' ; constructor ( ... args ) { super ( ... args ) ; if ( Error . captureStackTrace && typeof Error . captureStackTrace === 'function' ) { Error . captureStackTrace ( this , RedirectError ) ; } } setStatusCode ( code ) { this . statusCode = code ; } getStatusCode ( ) { return this . statusCode ; } setRedirect ( to ) { this . to = to ; } getRedirect ( ) { return this . to ; } set code ( code ) { this . statusCode = code ; } get code ( ) : number { return this . statusCode ; } } export default RedirectError ;