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

adapty.getPaywall throws if paywall doesn't exist for id #61

Open
amberv0 opened this issue Mar 21, 2023 · 2 comments
Open

adapty.getPaywall throws if paywall doesn't exist for id #61

amberv0 opened this issue Mar 21, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@amberv0
Copy link

amberv0 commented Mar 21, 2023

Description

After migrating from v1 to v2 I realize that I can't easily implement a scenario where I check the case where no paywalls match the requested id.
Before I could just do this:

const paywall = paywallsResponse.paywalls.find(
  (p) => p.developerId === paywallId
);
if(!paywall){
  // Do stuff
}

But now if I call adapty.getPaywall(paywallId) with an invalid paywallId it just throws, so I can't distinguish this specific case (the developer error, basically) from other cases.

The returned error is this, which is not very helpful:

{ [Error: #undefined (2004): Server error] adaptyCode: 2004, localizedDescription: 'Server error' }

I'm reporting this as a bug and not feature request since for me this is a regression in adapty sdk.

Version

v2.4.2

What platforms are you seeing the problem on?

iOS

System info

IDEs:
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
 
npmPackages:
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.3 => 0.70.3
@amberv0 amberv0 added the bug Something isn't working label Mar 21, 2023
@divanc
Copy link
Collaborator

divanc commented Mar 22, 2023

@amberv0
Hello again 👋
I'll discuss the possibility of adding 'not_found' error there today.

Since this is basically a network request, raising a 404 error (not the current one) seems valid to me, but you can try to coax me otherwise 👀

@amberv0
Copy link
Author

amberv0 commented Mar 22, 2023

404 sounds correct to me.
For the end user of the sdk it might be better to have adapty.getPaywall() return something like null, but I might be wrong.

@vladd-g vladd-g added enhancement New feature or request and removed bug Something isn't working labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants