sasjs / cli

Command line interface for creating, compiling, and building SAS® projects
https://cli.sasjs.io
MIT License
37 stars 5 forks source link

improve error when asset is not found for streaming apps #997

Closed allanbowe closed 3 years ago

allanbowe commented 3 years ago

When an asset is not found, an unhelpful message is displayed

image

To reproduce:

  1. Visit https://gitpod.io/#github.com/sasjs/angular-seed-app
  2. run npm i and npm i -g @sasjs/cli
  3. Set "streamWeb": true, in the viya target of the sasjsconfig.json file
  4. npm run build. (note - without this step, the command runs successfully, which is also a problem - it should fail if webSourcePath is not found and streamWeb is true)
  5. Add the following to the dist/index.html: <link rel="icon" type="image/svg+xml" href=logo_horiz.svg >
  6. Run sasjs compile

Result:

ℹ Compiling web app services since streamWeb is enabled.                                                                                                                                      16:20:50
ℹ Compiling web app services for target viya...                                                                                                                                               16:20:50

 ERROR  An error has occurred when compiling web app services.                                                                                                                                16:20:50

 ERROR  An error has occurred when compiling services.                                                                                                                                        16:20:50
 Cannot read property 'target' of undefined

Expected - when a file cannot be made streamable, we should provide additional information to help the developer debug, such as an excerpt of the statement, or the link that cannot be found.

krishna-acondy commented 3 years ago

This appears to be happening because of the code on either of these two lines:

https://github.com/sasjs/cli/blob/main/src/commands/web/web.ts#L327 https://github.com/sasjs/cli/blob/main/src/commands/web/web.ts#L347

We should probably add a check that throws an error and stops execution if a path is not found.

ghost commented 3 years ago

:tada: This issue has been resolved in version 2.38.8 :tada:

The release is available on:

Your semantic-release bot :package::rocket: