Fix fatal error due to unknown exception.

TermsSqlCache tired to throw an instance of Exception without
specifying a namespace, causing a fatal error. Changed that to
\MWException now.

Change-Id: Idbf67b96a64939e374cffb1f295ecb72137e5575