@ethernity-cloud/sdk-js 1.5.2 → 1.5.4
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/nodenithy/build/securelock/src/etny_exec.js +19 -14
- package/nodenithy/build/trustedzone/src/etny_exec.js +19 -14
- package/nodenithy/build/validator/src/etny_exec.js +19 -14
- package/nodenithy/run/image_registry.js +371 -371
- package/package.json +50 -50
- package/pynithy/run/image_registry.js +371 -371
|
@@ -88,24 +88,29 @@ function exec(payload, input, globals = null) {
|
|
|
88
88
|
|
|
89
89
|
// return [TaskStatus.SUCCESS, 'TASK EXECUTED SUCCESSFULLY'];
|
|
90
90
|
} catch (error) {
|
|
91
|
+
// A task returns its result by RETURNING (via ___etny_result___), not by
|
|
92
|
+
// throwing, so anything caught here is a genuine failure. In every branch
|
|
93
|
+
// deliver the FULL stack trace to the data owner AS THE RESULT (visible in
|
|
94
|
+
// their runner output) and never crash the enclave -- always return a
|
|
95
|
+
// normal [code, data] tuple so the trustedzone stops waiting. Honor the
|
|
96
|
+
// embedded-result SUCCESS (code 0) case first.
|
|
97
|
+
try {
|
|
98
|
+
if (error && error.args && error.args[0] && error.args[0][0] === 0) {
|
|
99
|
+
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
100
|
+
}
|
|
101
|
+
} catch (e) { /* fall through to failure reporting */ }
|
|
102
|
+
|
|
103
|
+
const detail = (error && (error.stack || error.message)) || String(error);
|
|
104
|
+
console.error('Error in payload execution -- full stack follows:\n' + detail);
|
|
105
|
+
|
|
91
106
|
if (error instanceof ReferenceError) {
|
|
92
|
-
return [TaskStatus.SYSTEM_ERROR,
|
|
107
|
+
return [TaskStatus.SYSTEM_ERROR, 'SYSTEM_ERROR (ReferenceError): ' + detail];
|
|
93
108
|
} else if (error instanceof EvalError) {
|
|
94
|
-
return [TaskStatus.KEY_ERROR,
|
|
109
|
+
return [TaskStatus.KEY_ERROR, 'KEY_ERROR (EvalError): ' + detail];
|
|
95
110
|
} else if (error instanceof SyntaxError) {
|
|
96
|
-
return [TaskStatus.SYNTAX_WARNING,
|
|
97
|
-
} else if (error instanceof Error) {
|
|
98
|
-
try {
|
|
99
|
-
if (error.args[0][0] === 0) {
|
|
100
|
-
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
101
|
-
} else {
|
|
102
|
-
return [TaskStatus.BASE_EXCEPTION, error.args[0]];
|
|
103
|
-
}
|
|
104
|
-
} catch (e) {
|
|
105
|
-
return [TaskStatus.BASE_EXCEPTION, error.message];
|
|
106
|
-
}
|
|
111
|
+
return [TaskStatus.SYNTAX_WARNING, 'SYNTAX_WARNING (SyntaxError): ' + detail];
|
|
107
112
|
} else {
|
|
108
|
-
return [TaskStatus.BASE_EXCEPTION,
|
|
113
|
+
return [TaskStatus.BASE_EXCEPTION, 'BASE_EXCEPTION: ' + detail];
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
}
|
|
@@ -27,24 +27,29 @@ function exec(payload, input, globals = null) {
|
|
|
27
27
|
|
|
28
28
|
// return [TaskStatus.SUCCESS, 'TASK EXECUTED SUCCESSFULLY'];
|
|
29
29
|
} catch (error) {
|
|
30
|
+
// A task returns its result by RETURNING (via ___etny_result___), not by
|
|
31
|
+
// throwing, so anything caught here is a genuine failure. In every branch
|
|
32
|
+
// deliver the FULL stack trace to the data owner AS THE RESULT (visible in
|
|
33
|
+
// their runner output) and never crash the enclave -- always return a
|
|
34
|
+
// normal [code, data] tuple so the trustedzone stops waiting. Honor the
|
|
35
|
+
// embedded-result SUCCESS (code 0) case first.
|
|
36
|
+
try {
|
|
37
|
+
if (error && error.args && error.args[0] && error.args[0][0] === 0) {
|
|
38
|
+
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
39
|
+
}
|
|
40
|
+
} catch (e) { /* fall through to failure reporting */ }
|
|
41
|
+
|
|
42
|
+
const detail = (error && (error.stack || error.message)) || String(error);
|
|
43
|
+
console.error('Error in payload execution -- full stack follows:\n' + detail);
|
|
44
|
+
|
|
30
45
|
if (error instanceof ReferenceError) {
|
|
31
|
-
return [TaskStatus.SYSTEM_ERROR,
|
|
46
|
+
return [TaskStatus.SYSTEM_ERROR, 'SYSTEM_ERROR (ReferenceError): ' + detail];
|
|
32
47
|
} else if (error instanceof EvalError) {
|
|
33
|
-
return [TaskStatus.KEY_ERROR,
|
|
48
|
+
return [TaskStatus.KEY_ERROR, 'KEY_ERROR (EvalError): ' + detail];
|
|
34
49
|
} else if (error instanceof SyntaxError) {
|
|
35
|
-
return [TaskStatus.SYNTAX_WARNING,
|
|
36
|
-
} else if (error instanceof Error) {
|
|
37
|
-
try {
|
|
38
|
-
if (error.args[0][0] === 0) {
|
|
39
|
-
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
40
|
-
} else {
|
|
41
|
-
return [TaskStatus.BASE_EXCEPTION, error.args[0]];
|
|
42
|
-
}
|
|
43
|
-
} catch (e) {
|
|
44
|
-
return [TaskStatus.BASE_EXCEPTION, error.message];
|
|
45
|
-
}
|
|
50
|
+
return [TaskStatus.SYNTAX_WARNING, 'SYNTAX_WARNING (SyntaxError): ' + detail];
|
|
46
51
|
} else {
|
|
47
|
-
return [TaskStatus.BASE_EXCEPTION,
|
|
52
|
+
return [TaskStatus.BASE_EXCEPTION, 'BASE_EXCEPTION: ' + detail];
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
}
|
|
@@ -25,24 +25,29 @@ function exec(payload, input, globals = null) {
|
|
|
25
25
|
|
|
26
26
|
// return [TaskStatus.SUCCESS, 'TASK EXECUTED SUCCESSFULLY'];
|
|
27
27
|
} catch (error) {
|
|
28
|
+
// A task returns its result by RETURNING (via ___etny_result___), not by
|
|
29
|
+
// throwing, so anything caught here is a genuine failure. In every branch
|
|
30
|
+
// deliver the FULL stack trace to the data owner AS THE RESULT (visible in
|
|
31
|
+
// their runner output) and never crash the enclave -- always return a
|
|
32
|
+
// normal [code, data] tuple so the trustedzone stops waiting. Honor the
|
|
33
|
+
// embedded-result SUCCESS (code 0) case first.
|
|
34
|
+
try {
|
|
35
|
+
if (error && error.args && error.args[0] && error.args[0][0] === 0) {
|
|
36
|
+
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
37
|
+
}
|
|
38
|
+
} catch (e) { /* fall through to failure reporting */ }
|
|
39
|
+
|
|
40
|
+
const detail = (error && (error.stack || error.message)) || String(error);
|
|
41
|
+
console.error('Error in payload execution -- full stack follows:\n' + detail);
|
|
42
|
+
|
|
28
43
|
if (error instanceof ReferenceError) {
|
|
29
|
-
return [TaskStatus.SYSTEM_ERROR,
|
|
44
|
+
return [TaskStatus.SYSTEM_ERROR, 'SYSTEM_ERROR (ReferenceError): ' + detail];
|
|
30
45
|
} else if (error instanceof EvalError) {
|
|
31
|
-
return [TaskStatus.KEY_ERROR,
|
|
46
|
+
return [TaskStatus.KEY_ERROR, 'KEY_ERROR (EvalError): ' + detail];
|
|
32
47
|
} else if (error instanceof SyntaxError) {
|
|
33
|
-
return [TaskStatus.SYNTAX_WARNING,
|
|
34
|
-
} else if (error instanceof Error) {
|
|
35
|
-
try {
|
|
36
|
-
if (error.args[0][0] === 0) {
|
|
37
|
-
return [TaskStatus.SUCCESS, error.args[0][1]];
|
|
38
|
-
} else {
|
|
39
|
-
return [TaskStatus.BASE_EXCEPTION, error.args[0]];
|
|
40
|
-
}
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return [TaskStatus.BASE_EXCEPTION, error.message];
|
|
43
|
-
}
|
|
48
|
+
return [TaskStatus.SYNTAX_WARNING, 'SYNTAX_WARNING (SyntaxError): ' + detail];
|
|
44
49
|
} else {
|
|
45
|
-
return [TaskStatus.BASE_EXCEPTION,
|
|
50
|
+
return [TaskStatus.BASE_EXCEPTION, 'BASE_EXCEPTION: ' + detail];
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
}
|