module.exports = function(chai) {
    var assert = chai.assert;

    assert.throwTerror = function(fn, ErrClass, spec) {
        var assertionArgs = [ fn ];

        if (typeof ErrClass !== 'function') {
            spec = ErrClass;
        } else {
            assertionArgs.push(ErrClass);

            try {
                switch (typeof spec) {
                    case 'string':
                        // get code by code name
                        spec = ErrClass.CODES[spec];
                        /* falls through */
                    case 'number':
                        // get message template by code and convert it to appropriate regexp
                        spec = new RegExp('^' + ErrClass.MESSAGES[spec].replace(/%.*%/g, '.*') + '$', 'ig');
                    // in other cases keep the spec as is
                }
            } catch (error) {
                // add hints to error message about invalid arguments for assertion
                if (error instanceof TypeError) {
                    if (typeof ErrClass.CODES === 'object' &&
                        typeof ErrClass.MESSAGES === 'object' &&
                        typeof ErrClass.prototype.name === 'string') {
                        error.message += [
                                ' (looks like error code passed to assert.throwTerror is not declared for ' +
                                ErrClass.prototype.name +
                                ')'
                            ].join('');
                    } else {
                        error.message +=
                            ' (looks like error class passed to assert.throwTerror is not a Terror inheritor)';
                    }
                }

                throw error;
            }
        }

        if (typeof spec !== 'undefined') {
            assertionArgs.push(spec);
        }

        assert.throw.apply(assert, assertionArgs);
    };
};

@@ -324,14 +324,10 @@
     
-switch
+if
  (ty
@@ -339,232 +339,25 @@
 spec
-) %7B%0A                    case 'string':%0A                        // get code by code name%0A                        spec = ErrClass.CODES%5Bspec%5D;%0A                        /* falls through */%0A                    case 'number':%0A    
+ === 'string') %7B%0A
     
@@ -441,20 +441,16 @@
  regexp%0A
-    
         
@@ -550,66 +550,8 @@
 ');%0A
-                    // in other cases keep the spec as is%0A
     

drop support of numeric terror specs