Skip to content
New issue

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

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

Already on GitHub? # to your account

[expo-updates] Make error messages consistent across platforms for dev client and disabled controllers #26988

Merged
merged 4 commits into from
Feb 8, 2024

Conversation

wschurman
Copy link
Member

Why

These messages should be more descriptive on iOS. They were already better on android since android exceptions are easier to use, but we can do some string interpolation on iOS to achieve the same set of error messages without needing to create a separate exception subclass for each error.

How

Update messages.

Test Plan

Inspect.

Checklist

@wschurman wschurman requested a review from douglowder as a code owner February 7, 2024 21:30
@wschurman wschurman requested a review from brentvatne February 7, 2024 21:30
@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Feb 7, 2024
@@ -318,19 +318,19 @@ public final class DevLauncherAppController: NSObject, InternalAppControllerInte
}

public func checkForUpdate(success successBlockArg: @escaping (CheckForUpdateResult) -> Void, error errorBlockArg: @escaping (ExpoModulesCore.Exception) -> Void) {
errorBlockArg(NotAvailableInDevClientException())
errorBlockArg(NotAvailableInDevClientException("check for update"))
Copy link
Member

Choose a reason for hiding this comment

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

should we use the js method names here, so people know exactly what to search their code for? so, checkForUpdateAsync in this case

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this, we should use the public API names

Copy link
Member Author

Choose a reason for hiding this comment

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

Potentially! I'm curious how we'd phrase it. Something like: "checkForUpdateAsync cannot be called from a development client. A non-development build should be used to test this functionality." ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not that it can't be called, it's more that while it can be called it will always throw. So maybe "checkForUpdateAsync is not available in development client builds. A non-development build should be used to test this functionality."

Copy link
Member

Choose a reason for hiding this comment

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

maybe:

Updates.checkForUpdateAsync() cannot be called from a development build. A release build should be used to test this functionality.

Copy link
Member Author

Choose a reason for hiding this comment

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

The "release build" is technically incorrect as well since a debug build can also be used if the correct EX_UPDATE_NATIVE_DEBUG flags are set as well. The set of builds that need to be used are "another type of build build except one that uses dev client".

Copy link
Member

@brentvatne brentvatne Feb 8, 2024

Choose a reason for hiding this comment

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

maybe we can remove the second sentence then?

also a slight tweak to wording maybe:

Updates.checkForUpdateAsync() was called, but it is a no-op in development builds.

Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't a no-op, it will throw an exception...

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the idea of making it a single sentence that implies that the inverse of a development build is where it is supported. I went with:

Updates.checkForUpdateAsync() is not supported in development builds.

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Feb 7, 2024
@wschurman wschurman requested review from brentvatne and ide February 7, 2024 21:56
@wschurman wschurman merged commit 5f529fd into main Feb 8, 2024
12 of 15 checks passed
@wschurman wschurman deleted the @wschurman/make-expo-updates-exceptions-consistent branch February 8, 2024 04:56
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Apr 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants