File tree 2 files changed +5
-7
lines changed
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ export class TNSPlayer extends Observable {
145
145
const errorRef = new interop . Reference < NSError > ( ) ;
146
146
this . _player = AVAudioPlayer . alloc ( ) . initWithContentsOfURLError ( NSURL . fileURLWithPath ( fileName ) , errorRef ) ;
147
147
if ( errorRef && errorRef . value ) {
148
- throw wrapNativeException ( errorRef . value ) ;
148
+ reject ( wrapNativeException ( errorRef . value ) ) ;
149
149
} else if ( this . _player ) {
150
150
this . handleStartPlayer ( options ) ;
151
151
@@ -184,7 +184,7 @@ export class TNSPlayer extends Observable {
184
184
const errorRef = new interop . Reference < NSError > ( ) ;
185
185
this . _player = AVAudioPlayer . alloc ( ) . initWithDataError ( data , errorRef ) ;
186
186
if ( errorRef && errorRef . value ) {
187
- throw wrapNativeException ( errorRef . value ) ;
187
+ reject ( wrapNativeException ( errorRef . value ) ) ;
188
188
} else if ( this . _player ) {
189
189
this . handleStartPlayer ( options ) ;
190
190
@@ -272,9 +272,7 @@ export class TNSPlayer extends Observable {
272
272
audioSession . setActiveError ( false ) ;
273
273
this . _reset ( ) ;
274
274
} catch ( ex ) {
275
- if ( this . errorCallback ) {
276
- this . errorCallback ( { ex } ) ;
277
- }
275
+ this . errorCallback ?.( { ex } ) ;
278
276
throw ex ;
279
277
}
280
278
}
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export class TNSRecorder extends Observable {
85
85
) ;
86
86
//@ts -ignore
87
87
if ( errorRef && errorRef . value ) {
88
- throw wrapNativeException ( errorRef . value ) ;
88
+ return reject ( wrapNativeException ( errorRef . value ) ) ;
89
89
}
90
90
91
91
this . _recordingSession . setActiveError ( true ) ;
@@ -132,7 +132,7 @@ export class TNSRecorder extends Observable {
132
132
this . _recorder = AVAudioRecorder . alloc ( ) . initWithURLSettingsError ( url , recordSetting , errorRef ) ;
133
133
}
134
134
if ( errorRef && errorRef . value ) {
135
- throw wrapNativeException ( errorRef . value ) ;
135
+ reject ( wrapNativeException ( errorRef . value ) ) ;
136
136
} else {
137
137
if ( ! this . _recorder . delegate ) {
138
138
this . _recorder . delegate = TNSRecorderDelegate . initWithOwner ( this ) ;
You can’t perform that action at this time.
0 commit comments