`extractNgramsFromDocument` shouldn't catch all exceptions (let alone async ones!)
@cgenie spotted a bug I have introduced as part of !415 (merged) . In particular, the extractNgramsFromDocument
function is catching all exceptions, and it's doing so using Control.Monad.Catch
and not Control.Exception.Safe
, which means that it will intercept things like the KillWorkerSafely
exceptions being thrown when we hard-quit the server with ctrl^c
.
I think that extractNgrams
should be given the ability of throw a specialised exception (like NgramsExtractionException
or similar) that can be used to wrap any HttpException
in the implementation of the main instance, so that we can catch the correct exception, leaving the other be.