Maid 407 handling mongodb error

Mongodb connection error has been handled and test case updated