JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test"></div>
JavaScript
(function(){
var _$ = $;
$ = function(){
var $res = _$.apply(0, arguments);
if(!$res.length && typeof arguments[0] === 'string')
throw 'No Element Found: ' + arguments[0];
return $res;
}
$ = _$.extend(true, $, _$);
})();
try{
// Throws Exception
$('span#test').text('FdOO');
}catch(err){
console.log('Caught: '+err);
// Works correctly
$('#test').text('BAR');
}
// Throws Exception
$('.nothing').css('color', '#0000FF');
// Uncaught exceptions stop execution in javascript
$('#test').text('This line isn\'t reached');