Skip to content

Commit

Permalink
Map errors properly
Browse files Browse the repository at this point in the history
  • Loading branch information
grabbou committed Jul 27, 2016
1 parent e9ab17c commit ea2214e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions RCTOpenTokPublisherView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@import UIKit;
#import "RCTOpenTokPublisherView.h"
#import "RCTEventDispatcher.h"
#import "RCTUtils.h"
#import <OpenTok/OpenTok.h>

@interface RCTOpenTokPublisherView () <OTSessionDelegate>
Expand Down Expand Up @@ -47,7 +48,7 @@ - (void)mount {
[_session connectWithToken:_token error:&error];

if (error) {
_onStartFailure(@{});
_onStartFailure(RCTJSErrorFromNSError(error));
}
}

Expand All @@ -66,7 +67,7 @@ - (void)startPublishing {
[_session publish:_publisher error:&error];

if (error) {
_onPublishError(@{});
_onPublishError(RCTJSErrorFromNSError(error));
return;
}

Expand Down Expand Up @@ -110,7 +111,7 @@ - (void)session:(OTSession *)session connectionDestroyed:(OTConnection *)connect
}

- (void)session:(OTSession*)session didFailWithError:(OTError*)error {
_onUnknownError(@{});
_onUnknownError(RCTJSErrorFromNSError(error));
}

# pragma mark - OTPublisher delegate callbacks
Expand All @@ -125,9 +126,9 @@ - (void)publisher:(OTPublisherKit*)publisher streamDestroyed:(OTStream *)stream
[self cleanupPublisher];
}

- (void)publisher:(OTPublisherKit*)publisher didFailWithError:(OTError*) error
- (void)publisher:(OTPublisherKit*)publisher didFailWithError:(OTError*)error
{
_onUnknownError(@{});
_onUnknownError(RCTJSErrorFromNSError(error));
[self cleanupPublisher];
}

Expand Down

0 comments on commit ea2214e

Please sign in to comment.