Hey, thought I'd do my part and contribute in what I found.
While using this library I noticed that on creation of mongo connections, if they error'd they would have their errors swallowed and you wouldn't be aware to this happening (e.g. auth failed and failed to connect etc).
I saw that #33 tried to do something similar but as @nswbmw said, you can't throw an error from the callback ... but this is because generic pool swallows it.
In generic-pool, when the create method is called a factory object is passed - if that factory returns an Error then the pool will throw the error for us and thus stop our koa server and make us aware somethings gone wrong.
Hope this makes sense, thanks for the middleware. 👍
Hey, thought I'd do my part and contribute in what I found.
While using this library I noticed that on creation of mongo connections, if they error'd they would have their errors swallowed and you wouldn't be aware to this happening (e.g. auth failed and failed to connect etc).
I saw that #33 tried to do something similar but as @nswbmw said, you can't throw an error from the callback ... but this is because generic pool swallows it.
In generic-pool, when the
create
method is called afactory
object is passed - if that factory returns anError
then the pool will throw the error for us and thus stop our koa server and make us aware somethings gone wrong.Hope this makes sense, thanks for the middleware. 👍