Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove potential error when setting exit code #640

Merged
merged 2 commits into from
Jun 15, 2024

Conversation

Molkars
Copy link
Contributor

@Molkars Molkars commented May 20, 2024

this PR implements a more reliable way of setting the CLI's exit code in error cases.

Previously, I encountered this error when running the cli:

$ cordova build
TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ERR_UNHANDLED_ERROR')
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at /opt/nodejs/lib/node_modules/cordova/bin/cordova:33:22

With this version, I get to see the root problem:

$ cordova build
Unhandled error. ('Parsing /home/me/hello/config.xml failed')

Platforms affected

Motivation and Context

Description

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

this commit implements a more reliable way of setting the CLI's exit code in error cases.

Previously, I encountered this error when running the cli:
```console
$ cordova build
TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ERR_UNHANDLED_ERROR')
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at /opt/nodejs/lib/node_modules/cordova/bin/cordova:33:22
```

With this version, I get to see the root problem:
```console
$ cordova build
Unhandled error. ('Parsing /home/me/hello/config.xml failed')
```
@Molkars
Copy link
Contributor Author

Molkars commented May 20, 2024

sorry to ignore the PR format, but... very simple change.

bin/cordova Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Molkars Molkars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.68%. Comparing base (c06b573) to head (fbf16da).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #640   +/-   ##
=======================================
  Coverage   70.68%   70.68%           
=======================================
  Files           4        4           
  Lines         307      307           
=======================================
  Hits          217      217           
  Misses         90       90           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@breautek breautek requested a review from erisu May 25, 2024 17:06
@breautek
Copy link
Contributor

All test passes. If there are no objections in the next couple of days or so I'll do a merge so that this change is included on our next release.

@breautek breautek merged commit b138eee into apache:master Jun 15, 2024
10 checks passed
@dpogue dpogue added this to the 13.0.0 milestone Jun 18, 2024
@Molkars Molkars deleted the patch-1 branch June 25, 2024 16:09
@Riquelme1075
Copy link

Good evening, did you manage to resolve it? I’ve tried everything and still couldn’t fix it. This error appeared out of nowhere. For example, at 8 PM I ran cordova platform add android, and at 10 PM I removed the platform and ran cordova platform add android again, and this is what appeared:

typescript
Copiar código
C:\app teste\rclmarcador\rclmarcador>cordova platform add android
TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ERR_UNHANDLED_ERROR')
at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
at C:\Users\maria\AppData\Roaming\npm\node_modules\cordova\bin\cordova:32:22

@Molkars
Copy link
Contributor Author

Molkars commented Jul 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants