Skip to content

Commit

Permalink
[futurepress#96] iOS: Improves error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
birdofpreyru committed Jan 5, 2024
1 parent d0a5218 commit 19436e9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ios/ReactNativeStaticServer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ - (NSDictionary*) getConstants {
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);

if (self->server) {
auto e = [[RNSSException name:@"Another server instance is active"] log];
NSString *name = [NSString stringWithFormat:@"Failed to launch server #%@, another server instance (#%@) is active", serverId, self->server.serverId];
auto e = [[RNSSException name:name] log];
[e reject:reject];
dispatch_semaphore_signal(sem);
return;
}

if (pendingResolve != nil || pendingReject != nil) {
auto e = [[RNSSException name:@"Internal error"
details:@"Non-expected pending promise"] log];
NSString *name = [NSString stringWithFormat:@"Internal error (server #%@)", serverId];
auto e = [[RNSSException name:name details:@"Non-expected pending promise"] log];
[e reject:reject];
dispatch_semaphore_signal(sem);
return;
Expand All @@ -129,7 +130,8 @@ - (NSDictionary*) getConstants {
];
} else {
if (signal == CRASHED) {
[[RNSSException name:@"Server crashed" details:details]
NSString *name = [NSString stringWithFormat:@"Server #%@ crashed", serverId];
[[RNSSException name:name details:details]
reject:pendingReject];
} else pendingResolve(details);
pendingResolve = nil;
Expand Down

0 comments on commit 19436e9

Please sign in to comment.