@skrillex1224/android-toolkit 0.1.9 → 1.0.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/README.md +51 -64
- package/browser.d.ts +31 -0
- package/dist/browser.js +107 -0
- package/dist/browser.js.map +7 -0
- package/dist/index.cjs +1910 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +1880 -0
- package/dist/index.js.map +7 -0
- package/index.d.ts +157 -184
- package/package.json +30 -10
- package/entrys/node.js +0 -26
- package/index.js +0 -1
- package/scripts/postinstall.js +0 -72
- package/src/apify-kit.js +0 -217
- package/src/constants.js +0 -75
- package/src/context.js +0 -89
- package/src/device.js +0 -761
- package/src/errors.js +0 -37
- package/src/frida-client.js +0 -1074
- package/src/internals/compression.js +0 -188
- package/src/internals/frida/webview_event_agent.js +0 -227
- package/src/launch.js +0 -70
- package/src/logger.js +0 -111
- package/src/share.js +0 -644
package/src/errors.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Code } from './constants.js';
|
|
2
|
-
|
|
3
|
-
// Android 原生自动化使用的结构化错误。
|
|
4
|
-
// 设计上对齐 playwright-toolkit 的 CrawlerError:业务层可以只 throw 普通 Error,
|
|
5
|
-
// 也可以 throw CrawlerError 携带 code/context,pushFailed 会统一解析。
|
|
6
|
-
export class CrawlerError extends Error {
|
|
7
|
-
constructor(input, options = {}) {
|
|
8
|
-
const payload = typeof input === 'string' ? { message: input } : (input || {});
|
|
9
|
-
super(payload.message || 'Android crawler error', options);
|
|
10
|
-
this.name = 'CrawlerError';
|
|
11
|
-
this.code = payload.code || Code.UnknownError;
|
|
12
|
-
this.context = payload.context || {};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static isCrawlerError(error) {
|
|
16
|
-
return error instanceof CrawlerError || error?.name === 'CrawlerError';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static from(error, fallback = {}) {
|
|
20
|
-
if (CrawlerError.isCrawlerError(error)) return error;
|
|
21
|
-
return new CrawlerError({
|
|
22
|
-
message: error?.message || String(error),
|
|
23
|
-
code: fallback.code || Code.UnknownError,
|
|
24
|
-
context: fallback.context || {}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function serializeError(error) {
|
|
30
|
-
if (!error) return { message: '' };
|
|
31
|
-
return {
|
|
32
|
-
name: error.name || 'Error',
|
|
33
|
-
message: error.message || String(error),
|
|
34
|
-
stack: error.stack || '',
|
|
35
|
-
code: error.code || ''
|
|
36
|
-
};
|
|
37
|
-
}
|