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

fix(cli): upgrade arg to fix uncaught user errors #25329

Merged
merged 4 commits into from
Nov 13, 2023

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Nov 10, 2023

Why

We currently still use arg@4.x.x, where some errors do not have a proper .code property. This results in the error handling not catching it, and making it feel that the CLI actually crashed instead of "denied" the command.

Before this PR

image

After this PR

image

How

  • Upgraded to arg@5.0.2, which includes better errors (with .code properties)
  • Updated the error handling to handle ARG_ errors, which are not ARG_CONFIG_ errors

Test Plan

  • Existing test cases
  • Run $ expo run:android --variant
  • Run $ expo run:android --port="hello" Well, forgot that NaN is actually a valid Number

Checklist

@byCedric byCedric force-pushed the @bycedric/cli/upgrade-arg-and-error-handling branch from 1748684 to 466f4a7 Compare November 10, 2023 16:21
@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Nov 10, 2023
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Nov 10, 2023
@byCedric byCedric merged commit 4e04394 into main Nov 13, 2023
20 of 21 checks passed
@byCedric byCedric deleted the @bycedric/cli/upgrade-arg-and-error-handling branch November 13, 2023 13:58
onizam95 pushed a commit to onizam95/expo-av-drm that referenced this pull request Jan 15, 2024
# Why

We currently still use `arg@4.x.x`, where some errors do not have a
proper `.code` property. This results in the error handling not catching
it, and making it feel that the CLI actually crashed instead of "denied"
the command.

### Before this PR

<img width="986" alt="image"
src="https://github.com/expo/expo/assets/1203991/ec893c11-fb9c-4764-8d12-07e3a32b3b58">

### After this PR

<img width="323" alt="image"
src="https://github.com/expo/expo/assets/1203991/8b874ae6-87b1-4491-9c7b-beedbd07d989">

# How

- Upgraded to `arg@5.0.2`, which includes better errors ([with `.code`
properties](https://github.com/vercel/arg/releases/tag/5.0.0))
- Updated the error handling to handle `ARG_` errors, which are not
`ARG_CONFIG_` errors


# Test Plan

- Existing test cases
- Run `$ expo run:android --variant`
- ~~Run `$ expo run:android --port="hello"`~~ Well, forgot that `NaN` is
actually a valid `Number`

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants