-
Notifications
You must be signed in to change notification settings - Fork 83
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
please change your code to throw in error conditions rather than return null #796
Comments
Thanks for raising this issue @olsonpm - nice catch, I think I agree with you on the approach of throwing an exception instead of returning Will chat with the team internally to verify if there's any contextual significance before proceeding further. |
@olsonpm - due to this being a breaking change for current users of the SDK, we'll be putting further development of this on the backburner to be done at another date, likely as part of a greater refactor to the JavaScript SDK. Will keep this issue open but unresolved until then. |
Makes sense. I really appreciate the update |
The change to having |
Internal ticket created FSSDK-9572 |
How would the enhancement work?
So far I've seen this pattern in
createInstance
andcreateUserExperience
createInstance
should throw instead of return null when an error occurs. i.e. the try/catch should be removed herecreateUserExperience
should throw when input is invalid with an error message explaining why. Returningnull
gives the devs no clue as to what went wrong or why - just that something went wrong. It is an error and should be treated as suchWhen would the enhancement be useful?
because returning null in error scenarios doesn't make sense. Devs naturally expect an error to bubble with the proper stack trace and error information rather than the function to return successfully and have to write the error edge case themselves.
The text was updated successfully, but these errors were encountered: