You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "suyanhanx (via GitHub)" <gi...@apache.org> on 2023/08/29 07:51:47 UTC
[GitHub] [incubator-opendal] suyanhanx opened a new pull request, #2969: feat(bindings/nodejs): pass presign test
suyanhanx opened a new pull request, #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308465659
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
Due to the lack of a proper ErrorKind in napi-rs, we can only check the inner error's content.
Nodejs could also check an error`s kind by calling `e.code`.
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
Due to the lack of a proper ErrorKind in napi-rs, we can only check the inner error's content.
Nodejs could also check an error's kind by calling `e.code`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo merged pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2969: feat(bindings/nodejs): pass presign test
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308454389
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
Does Node.js have its own error handling logic? I prefer using a more structured approach to error checking.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308489720
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
This is the flexibility of JavaScript. 😢
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
This is the flexibility of JavaScript. 😢
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308481046
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
Seems not a good design, I expect users can check `e.kind()`. There is nothing we can do about this. Let's keep as is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308465659
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
Due to the lack of a proper ErrorKind in napi-rs, we can only check the inner error's content.
Nodejs could check an error's kind by calling `e.code`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308528408
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
As of now, yes. The napi-rs can't define custom errors.
In JavaScript, an error typically consists of a code and a message, both of which are strings. This is what I meant by the flexibility of JavaScript.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2969: feat(bindings/nodejs): Implement presign test
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2969:
URL: https://github.com/apache/incubator-opendal/pull/2969#discussion_r1308499470
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
> This is the flexibility of JavaScript. 😢
More like a design issue about napi-rs. JavaScript itself returns error as a value instead of string.
##########
bindings/nodejs/tests/binding.js:
##########
@@ -75,6 +75,12 @@ Then('The async file {string} must have content {string}', async function (path,
assert(bs.toString() == content)
})
-Then('The presign operation should success or raise exception Unsupported', function () {
- // TODO: please implement me.
+Then('The presign operation should success or raise exception Unsupported', async function () {
+ try {
+ await this.op.presignStat('path', 1000)
+ await this.op.presignRead('path', 1000)
+ await this.op.presignWrite('path', 1000)
+ } catch (e) {
+ assert.ok(e.message.includes('Unsupported'))
Review Comment:
> This is the flexibility of JavaScript. 😢
More like a design issue about napi-rs. JavaScript itself returns error as a value instead of string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org