Open
Description
How would the enhancement work?
So far I've seen this pattern in createInstance
and createUserExperience
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 such
When 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.