google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.52k stars 422 forks source link

A silent failure occurs if a file path listed in `filePushOrder` does not exist #984

Open aviflax opened 9 months ago

aviflax commented 9 months ago

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

If a file path listed in filePushOrder does not exist, I would expect clasp push to fail with a clear error message.

Actual Behavior

It just skips the missing file and continues as if nothing went wrong.

Steps to Reproduce the Problem

  1. Add a path to a non-existing file to filePushOrder
  2. Run clasp push
    1. Observe that the output to stdout and stderr includes no error message about the non-existing file path
  3. Run echo $?
    1. Observe that the exit code of clasp push is 0 but should have been non-zero.

Specifications

Nu11u5 commented 9 months ago

I think this could be a warning, rather than an error that cancels the push and raises the exit code. If the file is no longer part of the project, that suggests it's not needed anymore.

aviflax commented 9 months ago

Could be, sure. But on the other hand, there’s the case of typos. In my case, I was trying to fix an intermittent problem with a program that seemed to be caused by race conditions in code loading. I thought it might help to have a certain file pushed first, before all the rest. So I added this key to the config file and pushed, and… no change.

Weeks later I double checked and realized I had a missing character in the file name, the result of a typo. So my attempted fix had never actually taken effect, and since clasp had (IMO) failed silently, it took me a long time to find out about it.

Personally I prefer tools to fail fast and fail loudly, any time they cannot accomplish exactly what I’ve asked them to do.