Error handling fix

Error handling fix
pull/209/head
Shahana Farooqui 5 years ago
parent 9f36e78e9f
commit ea86c12462

File diff suppressed because one or more lines are too long

@ -9,5 +9,5 @@
<link rel="stylesheet" href="styles.486014dd6111683683a1.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.beca9321d3ebde77a0d3.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.bfd91f4dd38c37c6c674.js"></script></body>
<script src="runtime.feee63dac552d8844834.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.bf4aafcd2364c6e5a38d.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
!function(e){function r(r){for(var n,i,c=r[0],a=r[1],f=r[2],p=0,s=[];p<c.length;p++)o[i=c[p]]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,c=1;c<t.length;c++)0!==o[t[c]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"dc65164c2cc38ecb3ec0",6:"8f2384e487c219c3bbe9",7:"423205d2b155f66c9648"}[e]+".js"}(e);var a=new Error;u=function(r){c.onerror=c.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",a.name="ChunkLoadError",a.type=n,a.request=u,t[1](a)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var c=window.webpackJsonp=window.webpackJsonp||[],a=c.push.bind(c);c.push=r,c=c.slice();for(var f=0;f<c.length;f++)r(c[f]);var l=a;t()}([]);

@ -0,0 +1 @@
!function(e){function r(r){for(var n,c,i=r[0],a=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[c=i[p]]&&s.push(o[c][0]),o[c]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=c(c.s=t[0]))}return e}var n={},o={0:0},u=[];function c(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,c.nc&&i.setAttribute("nonce",c.nc),i.src=function(e){return c.p+""+({}[e]||e)+"."+{1:"dc65164c2cc38ecb3ec0",6:"8f2384e487c219c3bbe9",7:"5b9eec5877f949c48a68"}[e]+".js"}(e);var a=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",a.name="ChunkLoadError",a.type=n,a.request=u,t[1](a)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},c.m=e,c.c=n,c.d=function(e,r,t){c.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,r){if(1&r&&(e=c(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(c.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)c.d(t,n,(function(r){return e[r]}).bind(null,n));return t},c.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(r,"a",r),r},c.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},c.p="",c.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=a;t()}([]);

@ -64,7 +64,8 @@ export class CLEffects implements OnDestroy {
}
}
this.router.navigate(['/error'], { state: { errorCode: code, errorMessage: message }});
return this.handleErrorWithoutAlert('FetchInfoCL', err);
this.handleErrorWithoutAlert('FetchInfoCL', err);
return of({type: RTLActions.VOID});
})
);
}
@ -85,7 +86,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchFeesCL', err);
this.handleErrorWithoutAlert('FetchFeesCL', err);
return of({type: RTLActions.VOID});
}
));
@ -104,7 +106,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchFeeRatesCL', err);
this.handleErrorWithoutAlert('FetchFeeRatesCL', err);
return of({type: RTLActions.VOID});
}
));
@ -123,7 +126,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchBalanceCL', err);
this.handleErrorWithoutAlert('FetchBalanceCL', err);
return of({type: RTLActions.VOID});
}
));
@ -142,7 +146,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchLocalRemoteBalanceCL', err);
this.handleErrorWithoutAlert('FetchLocalRemoteBalanceCL', err);
return of({type: RTLActions.VOID});
}
));
@ -160,7 +165,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
this.handleErrorWithAlert('ERROR', 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
return of({type: RTLActions.VOID});
}));
})
);
@ -189,7 +195,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchPeersCL', err);
this.handleErrorWithoutAlert('FetchPeersCL', err);
return of({type: RTLActions.VOID});
})
);
}
@ -211,7 +218,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Add Peer Failed', this.CHILD_API_URL + environment.PEERS_API, err);
this.handleErrorWithAlert('ERROR', 'Add Peer Failed', this.CHILD_API_URL + environment.PEERS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -233,7 +241,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id, err);
this.handleErrorWithAlert('ERROR', 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id, err);
return of({type: RTLActions.VOID});
})
);
}
@ -254,7 +263,8 @@ export class CLEffects implements OnDestroy {
};
},
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchChannelsCL', err);
this.handleErrorWithoutAlert('FetchChannelsCL', err);
return of({type: RTLActions.VOID});
})
));
}
@ -276,7 +286,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Open Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('ERROR', 'Open Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -298,7 +309,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('ERROR', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -321,7 +333,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('ERROR', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -342,7 +355,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchPaymentsCL', err);
this.handleErrorWithoutAlert('FetchPaymentsCL', err);
return of({type: RTLActions.VOID});
}
));
@ -361,7 +375,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API + '/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API + '/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -387,7 +402,7 @@ export class CLEffects implements OnDestroy {
this.logger.info(sendRes);
this.store.dispatch(new RTLActions.CloseSpinner());
if (sendRes.error) {
return this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, { status: sendRes.status, error: sendRes.error.message });
this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, { status: sendRes.status, error: sendRes.error.message });
} else {
this.store.dispatch(new RTLActions.OpenAlert({
width: '70%',
@ -403,7 +418,8 @@ export class CLEffects implements OnDestroy {
}
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, err);
this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, err);
return of({type: RTLActions.VOID});
})
);
})
@ -424,7 +440,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.SetQueryRoutesCL({ routes: [] }));
return this.handleErrorWithAlert('ERROR', 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
this.handleErrorWithAlert('ERROR', 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
return of({type: RTLActions.VOID});
})
);
}
@ -455,7 +472,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -478,7 +496,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -501,7 +520,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Invoice Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listInvoice?label=' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Invoice Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listInvoice?label=' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -536,7 +556,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'GetForwardingHistory', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Get Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards', err);
this.handleErrorWithAlert('ERROR', 'Get Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards', err);
return of({type: RTLActions.VOID});
})
);
})
@ -562,7 +583,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Delete Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
this.handleErrorWithAlert('ERROR', 'Delete Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -594,7 +616,8 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Add Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
this.handleErrorWithAlert('ERROR', 'Add Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -618,9 +641,10 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchInvoicesCL', err);
this.handleErrorWithoutAlert('FetchInvoicesCL', err);
return of({type: RTLActions.VOID});
}
));
));
}));
@Effect()
@ -641,7 +665,8 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'SetChannelTransactionCL', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Sending Fund Failed', this.CHILD_API_URL + environment.ON_CHAIN_API, err);
this.handleErrorWithAlert('ERROR', 'Sending Fund Failed', this.CHILD_API_URL + environment.ON_CHAIN_API, err);
return of({type: RTLActions.VOID});
}));
})
);
@ -694,11 +719,9 @@ export class CLEffects implements OnDestroy {
this.logger.error('ERROR IN: ' + actionName + '\n' + JSON.stringify(err));
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });
this.store.dispatch(new RTLActions.Signout());
} else {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: actionName, code: err.status.toString(), message: err.error.error }));
this.logger.error(err);
return of({ type: RTLActions.VOID });
}
}
@ -706,19 +729,15 @@ export class CLEffects implements OnDestroy {
this.logger.error(err);
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });
this.store.dispatch(new RTLActions.Signout());
} else {
this.store.dispatch(new RTLActions.CloseSpinner());
this.logger.error(err);
return of({
type: RTLActions.OPEN_ALERT,
payload: {
width: '70%', data: {
type: alerType, titleMessage: alertTitle,
message: JSON.stringify({ code: err.status, Message: err.error.error, URL: errURL })
}
this.store.dispatch(new RTLActions.OpenAlert({
width: '70%', data: {
type: alerType, titleMessage: alertTitle,
message: JSON.stringify({ code: err.status, Message: err.error.error, URL: errURL })
}
});
}));
}
}

@ -135,7 +135,7 @@
<mat-divider></mat-divider>
</mat-list>
</div>
<mat-progress-bar *ngIf="flgLoading[6]===true" mode="indeterminate" class="mt-minus-5"></mat-progress-bar>
<mat-progress-bar *ngIf="flgLoading[5]===true" mode="indeterminate" class="mt-minus-5"></mat-progress-bar>
<mat-divider></mat-divider>
</mat-card-content>
</mat-card>

@ -64,7 +64,7 @@ export class LNDEffects implements OnDestroy {
this.sessionService.removeItem('lndUnlocked');
this.logger.info('Redirecting to Unlock');
this.router.navigate(['/lnd/unlocklnd']);
return this.handleErrorWithoutAlert('FetchInfo', err);
this.handleErrorWithoutAlert('FetchInfo', err);
} else {
let code = err.status ? err.status : '';
let message = err.error.message ? err.error.message + ' ' : '';
@ -83,7 +83,8 @@ export class LNDEffects implements OnDestroy {
}
}
this.router.navigate(['/error'], { state: { errorCode: code, errorMessage: message }});
return this.handleErrorWithoutAlert('FetchInfo', err);
this.handleErrorWithoutAlert('FetchInfo', err);
return of({type: RTLActions.VOID});
}
})
);
@ -105,7 +106,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchPeers', err);
this.handleErrorWithoutAlert('FetchPeers', err);
return of({type: RTLActions.VOID});
})
);
}
@ -127,7 +129,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Add Peer Failed', this.CHILD_API_URL + environment.PEERS_API, err);
this.handleErrorWithAlert('ERROR', 'Add Peer Failed', this.CHILD_API_URL + environment.PEERS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -149,7 +152,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.pubkey, err);
this.handleErrorWithAlert('ERROR', 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.pubkey, err);
return of({type: RTLActions.VOID});
})
);
}
@ -183,7 +187,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Add Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
this.handleErrorWithAlert('ERROR', 'Add Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -210,7 +215,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Open Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('ERROR', 'Open Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -233,7 +239,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/chanPolicy', err);
this.handleErrorWithAlert('ERROR', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/chanPolicy', err);
return of({type: RTLActions.VOID});
})
);
}
@ -263,7 +270,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly, err);
this.handleErrorWithAlert('ERROR', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly, err);
return of({type: RTLActions.VOID});
})
);
}
@ -287,7 +295,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'BackupChannels', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', action.payload.showMessage + ' ' + 'Unable to Backup Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('ERROR', action.payload.showMessage + ' ' + 'Unable to Backup Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint, err);
return of({type: RTLActions.VOID});
})
);
}
@ -311,7 +320,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'VerifyChannels', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Unable to Verify Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('ERROR', 'Unable to Verify Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, err);
return of({type: RTLActions.VOID});
})
);
}
@ -336,7 +346,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'RestoreChannels', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Unable to Restore Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('ERROR', 'Unable to Restore Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, err);
return of({type: RTLActions.VOID});
})
);
}
@ -357,7 +368,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchFees', err);
this.handleErrorWithoutAlert('FetchFees', err);
return of({type: RTLActions.VOID});
})
);
@ -380,7 +392,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchBalance/' + action.payload, err);
this.handleErrorWithoutAlert('FetchBalance/' + action.payload, err);
return of({type: RTLActions.VOID});
}
));
}
@ -401,7 +414,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchNetwork', err);
this.handleErrorWithoutAlert('FetchNetwork', err);
return of({type: RTLActions.VOID});
}
));
@ -449,7 +463,8 @@ export class LNDEffects implements OnDestroy {
}
},
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchChannels/' + action.payload.routeParam, err);
this.handleErrorWithoutAlert('FetchChannels/' + action.payload.routeParam, err);
return of({type: RTLActions.VOID});
})
));
}
@ -475,7 +490,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchInvoices', err);
this.handleErrorWithoutAlert('FetchInvoices', err);
return of({type: RTLActions.VOID});
}
));
}));
@ -495,7 +511,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchTransactions', err);
this.handleErrorWithoutAlert('FetchTransactions', err);
return of({type: RTLActions.VOID});
}
));
@ -514,7 +531,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchPayments', err);
this.handleErrorWithoutAlert('FetchPayments', err);
return of({type: RTLActions.VOID});
}
));
@ -533,7 +551,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYREQUEST_API + '/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYREQUEST_API + '/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -599,7 +618,8 @@ export class LNDEffects implements OnDestroy {
}
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', err);
this.handleErrorWithAlert('ERROR', 'Send Payment Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', err);
return of({type: RTLActions.VOID});
})
);
})
@ -619,7 +639,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Get Node Address Failed', this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Get Node Address Failed', this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload, err);
return of({type: RTLActions.VOID});
}));
}
));
@ -647,7 +668,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Generate New Address Failed', this.CHILD_API_URL + environment.NEW_ADDRESS_API + '?type=' + action.payload.addressId, err);
this.handleErrorWithAlert('ERROR', 'Generate New Address Failed', this.CHILD_API_URL + environment.NEW_ADDRESS_API + '?type=' + action.payload.addressId, err);
return of({type: RTLActions.VOID});
}));
})
);
@ -681,7 +703,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'SetChannelTransaction', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Sending Fund Failed', this.CHILD_API_URL + environment.TRANSACTIONS_API, err);
this.handleErrorWithAlert('ERROR', 'Sending Fund Failed', this.CHILD_API_URL + environment.TRANSACTIONS_API, err);
return of({type: RTLActions.VOID});
}));
})
);
@ -705,7 +728,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'GetForwardingHistory', code: err.status, message: err.error.error }));
return this.handleErrorWithAlert('ERROR', 'Get Forwarding History Failed', this.CHILD_API_URL + environment.SWITCH_API, err);
this.handleErrorWithAlert('ERROR', 'Get Forwarding History Failed', this.CHILD_API_URL + environment.SWITCH_API, err);
return of({type: RTLActions.VOID});
})
);
})
@ -726,7 +750,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.SetQueryRoutes({}));
return this.handleErrorWithAlert('ERROR', 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API, err);
this.handleErrorWithAlert('ERROR', 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API, err);
return of({type: RTLActions.VOID});
})
);
}
@ -756,7 +781,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err) => {
return this.handleErrorWithAlert('ERROR', err.error.message + ' ' + err.error.error.code, this.CHILD_API_URL + environment.WALLET_API + '/genseed/' + action.payload, err);
this.handleErrorWithAlert('ERROR', err.error.message + ' ' + err.error.error.code, this.CHILD_API_URL + environment.WALLET_API + '/genseed/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
}
@ -777,7 +803,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err) => {
return this.handleErrorWithAlert('ERROR', 'Update macaroon for newly initialized node failed! Please check the macaroon path and restart the server!', 'Update Macaroon', err);
this.handleErrorWithAlert('ERROR', 'Update macaroon for newly initialized node failed! Please check the macaroon path and restart the server!', 'Update Macaroon', err);
return of({type: RTLActions.VOID});
})
);
}
@ -819,7 +846,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err) => {
return this.handleErrorWithAlert('ERROR', err.error.error, this.CHILD_API_URL + environment.WALLET_API + '/initwallet', err);
this.handleErrorWithAlert('ERROR', err.error.error, this.CHILD_API_URL + environment.WALLET_API + '/initwallet', err);
return of({type: RTLActions.VOID});
})
);
}
@ -841,12 +869,12 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.logger.info('Successfully Initialized!');
this.store.dispatch(new RTLActions.FetchInfo({loadPage: 'HOME'}));
// this.router.navigate(['/lnd/home']);
}, 1000 * 90);
return { type: RTLActions.VOID };
}),
catchError((err) => {
return this.handleErrorWithAlert('ERROR', 'err.error.error', this.CHILD_API_URL + environment.WALLET_API + '/unlockwallet', err);
this.handleErrorWithAlert('ERROR', err.error.error, this.CHILD_API_URL + environment.WALLET_API + '/unlockwallet', err);
return of({ type: RTLActions.VOID });
})
);
}
@ -869,7 +897,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'Lookup', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -892,7 +921,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'Lookup', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/edge/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/edge/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -915,7 +945,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'Lookup', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Invoice Lookup Failed', this.CHILD_API_URL + environment.INVOICES_API + '/' + action.payload, err);
this.handleErrorWithAlert('ERROR', 'Invoice Lookup Failed', this.CHILD_API_URL + environment.INVOICES_API + '/' + action.payload, err);
return of({type: RTLActions.VOID});
})
);
})
@ -948,7 +979,8 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: 'RestoreChannelsList', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Restore Channels List Failed', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API, err);
this.handleErrorWithAlert('ERROR', 'Restore Channels List Failed', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API, err);
return of({type: RTLActions.VOID});
})
);
})
@ -1014,10 +1046,9 @@ export class LNDEffects implements OnDestroy {
this.logger.error('ERROR IN: ' + actionName + '\n' + JSON.stringify(err));
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });
this.store.dispatch(new RTLActions.Signout());
} else {
this.store.dispatch(new RTLActions.EffectErrorLnd({ action: actionName, code: err.status.toString(), message: err.error.error }));
return of({ type: RTLActions.VOID });
}
}
@ -1025,18 +1056,15 @@ export class LNDEffects implements OnDestroy {
this.logger.error(err);
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });
this.store.dispatch(new RTLActions.Signout());
} else {
this.store.dispatch(new RTLActions.CloseSpinner());
return of({
type: RTLActions.OPEN_ALERT,
payload: {
width: '70%', data: {
type: alertType, titleMessage: alertTitle,
message: JSON.stringify({ code: err.status, Message: err.error.error, URL: errURL })
}
this.store.dispatch(new RTLActions.OpenAlert({
width: '70%', data: {
type: alertType, titleMessage: alertTitle,
message: JSON.stringify({ code: err.status, Message: err.error.error, URL: errURL })
}
});
}));
}
}

Loading…
Cancel
Save