angelnikolov / ts-cacheable

Observable/Promise Cache Decorator
https://npmjs.com/package/ts-cacheable
ISC License
340 stars 42 forks source link

throwError() result is cached #29

Closed fimius23 closed 5 years ago

fimius23 commented 5 years ago

Sometimes I like to validate the arguments for the function where the httpClient is used. If the arguments are invalid I use the throwError() function. Currently the logic of your library (which I find to be a great solution that inventively uses the power of typescript) will cache the result of throwError(). I wonder if it could not cache the result.

I did find a way around, which is to instantiate an HttpErrorResponse and pass that to the throwError() function, but I wonder if that should be required.

Thanks for your hard work!

angelnikolov commented 5 years ago

Hey @fimius23, I will try to find some time tomorrow or over the weekend, but in the meantime - a stackblitz repro is always welcome :)))

fimius23 commented 5 years ago

I'm not able to reproduce this problem. I did have a witness who swears he saw it too, and we are both confused. Hopefully I didn't waste any of your time!

fimius23 commented 5 years ago

Not reproducible.