@appium/coresim 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.14.1](https://github.com/appium/appium-ios/compare/@appium/coresim@1.14.0...@appium/coresim@1.14.1) (2026-11-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **coresim:** include the failure reason and underlying errors in operation errors ([#163](https://github.com/appium/appium-ios/issues/163)) ([0032a91](https://github.com/appium/appium-ios/commit/0032a918d11d6d883f2896b907b0fbca2a734353))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## [1.14.0](https://github.com/appium/appium-ios/compare/@appium/coresim@1.13.2...@appium/coresim@1.14.0) (2026-10-24)
|
|
7
14
|
|
|
8
15
|
### Features
|
package/lib/src/errors.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class NativeSimOperationError extends NativeSimError {
|
|
|
40
40
|
readonly code: number;
|
|
41
41
|
name: string;
|
|
42
42
|
/**
|
|
43
|
-
* @param message — `NSError.localizedDescription
|
|
43
|
+
* @param message — `NSError.localizedDescription`, followed by its failure reason and underlying errors
|
|
44
44
|
* @param domain — `NSError.domain`
|
|
45
45
|
* @param code — `NSError.code`
|
|
46
46
|
*/
|
package/lib/src/errors.js
CHANGED
|
@@ -51,7 +51,7 @@ export class NativeSimOperationError extends NativeSimError {
|
|
|
51
51
|
code;
|
|
52
52
|
name = 'NativeSimOperationError';
|
|
53
53
|
/**
|
|
54
|
-
* @param message — `NSError.localizedDescription
|
|
54
|
+
* @param message — `NSError.localizedDescription`, followed by its failure reason and underlying errors
|
|
55
55
|
* @param domain — `NSError.domain`
|
|
56
56
|
* @param code — `NSError.code`
|
|
57
57
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/coresim",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "Native bindings to CoreSimulator.framework for Apple platform simulator control",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/appium/appium-ios/issues"
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"npm": ">=10"
|
|
63
63
|
},
|
|
64
64
|
"gypfile": true,
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "90882926f5dd3e4d34a056312f05787d513d0fd5"
|
|
66
66
|
}
|
|
Binary file
|
package/src/errors.ts
CHANGED
|
@@ -55,7 +55,7 @@ export class NativeSimOperationError extends NativeSimError {
|
|
|
55
55
|
public override name = 'NativeSimOperationError';
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* @param message — `NSError.localizedDescription
|
|
58
|
+
* @param message — `NSError.localizedDescription`, followed by its failure reason and underlying errors
|
|
59
59
|
* @param domain — `NSError.domain`
|
|
60
60
|
* @param code — `NSError.code`
|
|
61
61
|
*/
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
namespace coresim {
|
|
13
13
|
|
|
14
|
+
// localizedDescription is often generic ("Simulator device failed to install the application."), so
|
|
15
|
+
// the failure reason and the NSUnderlyingErrorKey chain are appended.
|
|
16
|
+
std::string DescribeNSError(NSError* error);
|
|
17
|
+
|
|
14
18
|
// Thrown by async work lambdas (see async_bridge.h) when a native call fails via an NSError**
|
|
15
19
|
// out-param rather than raising. domain/code/message are captured immediately at throw time
|
|
16
20
|
// (never the NSError* itself), since this only ever needs to survive within the same background
|
|
@@ -18,7 +22,7 @@ namespace coresim {
|
|
|
18
22
|
class NSErrorException : public std::runtime_error {
|
|
19
23
|
public:
|
|
20
24
|
explicit NSErrorException(NSError* error)
|
|
21
|
-
: std::runtime_error(error
|
|
25
|
+
: std::runtime_error(DescribeNSError(error)),
|
|
22
26
|
domain(error.domain ? error.domain.UTF8String : ""),
|
|
23
27
|
code(error.code) {}
|
|
24
28
|
|
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
namespace coresim {
|
|
4
4
|
|
|
5
|
+
std::string DescribeNSError(NSError* error) {
|
|
6
|
+
constexpr NSUInteger kMaxErrorDepth = 10;
|
|
7
|
+
NSMutableArray<NSString*>* parts = [NSMutableArray array];
|
|
8
|
+
NSError* current = error;
|
|
9
|
+
for (NSUInteger depth = 0; current != nil && depth < kMaxErrorDepth; ++depth) {
|
|
10
|
+
for (NSString* text in @[ current.localizedDescription ?: @"", current.localizedFailureReason ?: @"" ]) {
|
|
11
|
+
NSString* trimmed = [text stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
|
12
|
+
NSUInteger known = [parts indexOfObjectPassingTest:^BOOL(NSString* part, NSUInteger, BOOL*) {
|
|
13
|
+
return [part containsString:trimmed];
|
|
14
|
+
}];
|
|
15
|
+
if (trimmed.length == 0 || known != NSNotFound) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
NSIndexSet* covered = [parts indexesOfObjectsPassingTest:^BOOL(NSString* part, NSUInteger, BOOL*) {
|
|
19
|
+
return [trimmed containsString:part];
|
|
20
|
+
}];
|
|
21
|
+
[parts removeObjectsAtIndexes:covered];
|
|
22
|
+
[parts addObject:trimmed];
|
|
23
|
+
}
|
|
24
|
+
id underlying = current.userInfo[NSUnderlyingErrorKey];
|
|
25
|
+
current = [underlying isKindOfClass:NSError.class] ? underlying : nil;
|
|
26
|
+
}
|
|
27
|
+
NSMutableArray<NSString*>* sentences = [NSMutableArray arrayWithCapacity:parts.count];
|
|
28
|
+
for (NSString* part in parts) {
|
|
29
|
+
BOOL terminated = [part hasSuffix:@"."] || [part hasSuffix:@"!"] || [part hasSuffix:@"?"];
|
|
30
|
+
[sentences addObject:terminated ? part : [part stringByAppendingString:@"."]];
|
|
31
|
+
}
|
|
32
|
+
return sentences.count > 0 ? [sentences componentsJoinedByString:@" "].UTF8String : "Operation failed";
|
|
33
|
+
}
|
|
34
|
+
|
|
5
35
|
Napi::Error NSErrorExceptionToJsError(Napi::Env env, const NSErrorException& error) {
|
|
6
36
|
Napi::Error jsError = Napi::Error::New(env, error.what());
|
|
7
37
|
jsError.Set("name", "NativeSimOperationError");
|