evaera / roblox-lua-promise

Promise implementation for Roblox
https://eryn.io/roblox-lua-promise/
MIT License
275 stars 74 forks source link

Improve promise:expect() output in edge case #87

Closed AmberGraceRblx closed 1 year ago

AmberGraceRblx commented 1 year ago

Hi. Provided we're over some silly past github drama, I think this is a well-made library and I am using it in a production project.

I noticed an edge case with output when using :expect() on an asynchronous function that fails, producing a not-so-useful "Error Occurred: No Output From Lua" (ignore the line numbers here, as I'm using a forked version of the library with type annotations)

image

The change in this PR produces a more useful error message in this edge case, though I'm still investigating why there was an empty error message encountered in the first place.

evaera commented 1 year ago

It seems very unusual for an empty string to be passed as a rejection value. If it is, adding that as a condition to the existing error message isn't correct, because an empty string is not the same as "no value".

I don't think it's worth having an additional special case just for when the rejection value is an empty string.