Add custom exception when jacobian matrix is not invertible.