VROES.import from invalid package throws Unknown error #311
Labels
area/ecmascript
Relates to ecmascript module
effort/medium
kind/bug
Something isn't working
lang/typescript
Related to typescript code
priority/medium
triage/accepted
The issue was accepted and will be done
Description
When VROES.import().from() is used with invalid , it throws an Unknown error, which cannot be caught in a try/catch block (see attached screenshot).
Steps to Reproduce
where "bloo" is an invalid package name
Preconditions: [What are the preconditions to reproduce the issue]
Expected behavior: An error with message of the type "Caught unexpected error: ..." is thrown
Actual behavior: An Unknown Error is thrown - see attached screenshot:
Reproduces how often: Always.
Component/s: [packages/ecmascript/VROES, packages/ecmascript/Module
Affects Build/s: tested with 2.35.1, does not seem to have been altered since then.
Environment
Issue found on a client environment (no longer accessible)
Client
Server
Failure Logs
Orchestrator logs cease at the point the Unknown error is thrown.
Related issues and PRs
N/A
Additional Context
https://github.com/vmware/build-tools-for-vmware-aria/blob/main/packages/ecmascript/src/Module.ts#L188 -> missing ELSE statement may be what's causing the issue.
A better approach to returning the result directly would be to store the result in a variable and throw an error if there is none in the end (preferably after try/catch, as System.getModule > module.loadModule doesn't have error handling either:
https://github.com/vmware/build-tools-for-vmware-aria/blob/main/typescript/vro-scripting-api/src/api/System.ts#L270 > https://github.com/vmware/build-tools-for-vmware-aria/blob/main/typescript/vro-scripting-api/src/modules.ts#L40
)
The text was updated successfully, but these errors were encountered: