forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnserror_util.mm
38 lines (29 loc) · 1.09 KB
/
nserror_util.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/testing/nserror_util.h"
#import <Foundation/Foundation.h>
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// A custom NSError subclass that is marked as an eDO "value type", allowing
// it to be serialized and reconstructed in the remote process, rather than
// having all its method proxied via IPC.
@interface ChromeRemoteError : NSError
@end
@implementation ChromeRemoteError
- (BOOL)edo_isEDOValueType {
return YES;
}
@end
namespace testing {
NSError* NSErrorWithLocalizedDescription(NSString* error_description) {
NSString* errorDomain = @"com.google.chrome.errorDomain";
NSDictionary* userInfo = @{
NSLocalizedDescriptionKey : error_description,
};
return [[ChromeRemoteError alloc] initWithDomain:errorDomain
code:0
userInfo:userInfo];
}
} // namespace testing