Applying FunctionContinuous in Module to a function parameter

I have a function:

f[x_] = Tanh[2x - 1] * Cos[x] - Sin[x] / x 

which is discontinuous in $ x=0$ . I am building a Module[], which is supposed to calculating an integral of given function:

MyNIntegral[f_, x_, a_, b_, n_:1000] := Module[{division, result},   If[Not[FunctionContinuous[{f[s], a <= s <= b}, s]], Print["Error"], Print["It is good!"]]   division = Table[a + k * (b - a) / n, {k, 1, n - 1}];   result = (b - a) / n * (f[a] / 2 + Sum[f[division[[k]]], {k, 1, n - 1}] + f[b] / 2);   Return[result]; ] 

Obviously, the function generates the problem – division by zero, when a_ = 0. I would like to inform an user that such a problem occured and abort the evaluation of the Module[].

But some errors have shown up:

  • Set: Tag Times in division$ 651124False is Protected.
  • Part: specification division$ 651124[[1]] is longer than depth of object.
  • Part: specification division$ 651124[[2]] is longer than depth of object.
  • Part: specification division$ 651124[[3]] is longer than depth of object.

Is this caused by the protecion of passed arguments? What can I do with that? How to use a function on a function inside module?