MCPcopy Index your code
hub / github.com/Macuyiko/minecraft-python / _throws

Function _throws

ServerEditorWeb/ace/worker-html.js:9859–9888  ·  view source on GitHub ↗
(shouldThrow, block, expected, message)

Source from the content-addressed store, hash-verified

9857}
9858
9859function _throws(shouldThrow, block, expected, message) {
9860 var actual;
9861
9862 if (util.isString(expected)) {
9863 message = expected;
9864 expected = null;
9865 }
9866
9867 try {
9868 block();
9869 } catch (e) {
9870 actual = e;
9871 }
9872
9873 message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
9874 (message ? ' ' + message : '.');
9875
9876 if (shouldThrow && !actual) {
9877 fail(actual, expected, 'Missing expected exception' + message);
9878 }
9879
9880 if (!shouldThrow && expectedException(actual, expected)) {
9881 fail(actual, expected, 'Got unwanted exception' + message);
9882 }
9883
9884 if ((shouldThrow && actual && expected &&
9885 !expectedException(actual, expected)) || (!shouldThrow && actual)) {
9886 throw actual;
9887 }
9888}
9889
9890assert.throws = function(block, /*optional*/error, /*optional*/message) {
9891 _throws.apply(this, [true].concat(pSlice.call(arguments)));

Callers

nothing calls this directly

Calls 3

blockFunction · 0.85
failFunction · 0.85
expectedExceptionFunction · 0.85

Tested by

no test coverage detected