Try-catch doesn't work if it wraps async callback passing.
jQuery('a#encode-url-encode, a#encode-url-decode').click(function() {
if (jQuery('input#encode-url-input').val().length == 0) showCustomAlert('<strong>Warning!</strong> Please enter value.');
var result = null;
try { //It needs to be here.
if (jQuery(this).attr('id') == 'encode-url-encode') result = decodeURI(encodeURI(jQuery('input#encode-url-input').val()));
else if (jQuery(this).attr('id') == 'encode-url-decode') result = decodeURI(decodeURI(jQuery('input#encode-url-input').val()));
} catch (e) {
//handle
}
jQuery('textarea#encode-url-result').val(result);
});