1 // Copyright 2015-present 650 Industries. All rights reserved. 2 // 3 // Keeps track of experience error state, including between reloads, so that we can 4 // pass error recovery info to an experience which just reloaded. 5 // 6 7 #import "EXErrorRecovery.h" 8 #import "EXKernelService.h" 9 10 @class EXKernelAppRecord; 11 12 @interface EXErrorRecoveryManager : NSObject 13 <EXKernelService, EXErrorRecoveryScopedModuleDelegate> 14 15 /** 16 * Associate arbitrary developer info with this experience id. If the experience recovers from an 17 * error, we can pass this info to the new instance of the experience. 18 */ 19 - (void)setDeveloperInfo: (NSDictionary *)developerInfo forExperienceid: (NSString *)experienceId; 20 - (NSDictionary *)developerInfoForExperienceId: (NSString *)experienceId; 21 22 /** 23 * Associate an error with an experience id. This will never be cleared until the next 24 * call to `experienceFinishedLoadingWithId:`. 25 */ 26 - (void)setError: (NSError *)error forExperienceId: (NSString *)experienceId; 27 28 /** 29 * Indicate that a JS bundle has successfully loaded for this experience id. 30 */ 31 - (void)experienceFinishedLoadingWithId:(NSString *)experienceId; 32 33 /** 34 * True if any bridge for this experience id had an error, and has not successfully loaded 35 * since the error was reported. 36 */ 37 - (BOOL)experienceIdIsRecoveringFromError:(NSString *)experienceId; 38 39 /** 40 * True if this error object (by `isEqual:`) has been registered for any experience id. 41 */ 42 - (BOOL)errorBelongsToExperience: (NSError *)error; 43 44 /** 45 * Returns any existing app record for this error. Since error state persists between reloads until cleared, 46 * it's possible that there is no app record for this error. 47 */ 48 - (EXKernelAppRecord *)appRecordForError: (NSError *)error; 49 50 /** 51 * Whether we want to auto-reload this experience if it encounters a fatal error. 52 */ 53 - (BOOL)experienceIdShouldReloadOnError: (NSString *)experienceId; 54 55 /** 56 * Back off to a less aggressive autoreload buffer time. 57 * The longer the time, the longer a experience must wait before a fatal JS error triggers auto reload 58 * via `experienceIdShouldReloadOnError:`. 59 */ 60 - (void)increaseAutoReloadBuffer; 61 62 @end 63