File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ interface Events {
2626
2727 // Called when the sender cancels the transfer
2828 cancelled ( ) : void
29+
30+ // Called when simple-peer connexion closes with error
31+ error ( reason ?: string ) : void
2932}
3033
3134class ReceiveStream extends Writable {
@@ -84,6 +87,9 @@ export default class PeerFileReceive extends EventEmitter<Events> {
8487
8588 this . rs = new ReceiveStream ( )
8689 this . peer = peer
90+ this . peer . on ( "error" , err => {
91+ this . emit ( 'error' , JSON . stringify ( err ) ) ;
92+ } ) ;
8793
8894 peer . pipe ( this . rs )
8995
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ interface Events {
2929
3030 // Called when the receiver has requested a cancel
3131 cancelled ( ) : void
32+
33+ // Called when simple-peer connexion closes with error
34+ error ( reason ?: string ) : void
3235}
3336
3437/**
@@ -112,6 +115,10 @@ export default class PeerFileSend extends EventEmitter<Events> {
112115 super ( )
113116
114117 this . peer = peer
118+ this . peer . on ( "error" , err => {
119+ this . emit ( 'error' , JSON . stringify ( err ) ) ;
120+ } ) ;
121+
115122 this . file = file
116123 this . offset = offset
117124 }
You can’t perform that action at this time.
0 commit comments