+- (void)showNextError {
+ if (!self.window.attachedSheet && _errors.count) {
+ NSError *error = _errors.lastObject;
+ [_errors removeLastObject];
+ [NSApplication.sharedApplication activateIgnoringOtherApps:YES];
+ [self.window makeKeyAndOrderFront:nil];
+ [self.window presentError:error
+ modalForWindow:self.window
+ delegate:self
+ didPresentSelector:@selector(didPresentErrorWithRecovery:contextInfo:)
+ contextInfo:nil];
+ }
+}
+
+- (void)didPresentErrorWithRecovery:(BOOL)didRecover
+ contextInfo:(void *)contextInfo {
+ [self showNextError];
+}
+
+- (void)presentErrorSheet:(NSError *)error {
+ if (!_errors)
+ _errors = [[NSMutableArray alloc] initWithCapacity:1];
+ [_errors insertObject:error atIndex:0];
+ [self showNextError];
+}
+