goharbor / xk6-harbor

GNU Affero General Public License v3.0
6 stars 14 forks source link

Needed to maintain listing in k6 Extensions Registry #9

Open javaducky opened 1 year ago

javaducky commented 1 year ago

We've recently updated the requirements for maintaining an extension within the listing on our site. As such, please address the following items to maintain your listing within the registry:

For more information on these and other listing requirements, please take a look at the registry requirements.

chlins commented 1 year ago

@javaducky Hi, thanks for your update, but we ran into a situation after upgrade the k6 to v0.45, I would like for some suggestions or best practices from k6 team. Here is our question, in the previous version, we used common.Throw to throw error from the golang module and then we can use the try catch to catch up the error from the JS scripts, but since we upgraded to the latest k6, the error cannot be caught from js.

Sample code:

export function setup() {
    // harbor.initialize(settings.Harbor)

    try {
        harbor.deleteProject('library')
    } catch (e) {
        console.log(e)
    }
}

previous behavior if an error occurred:

INFO[0000] GoError: failed to delete project library, error: project library not found  source=console

after upgrade the error seems lost:

INFO[0004] {"value":{}}                                  source=console
chlins commented 1 year ago

Found the problem is caused by the error object, when use console.log(e.stack) or console.log(e.message) it can print the expected error message like previous.