let's say i have a simple function:
    function test(url){
var AjaxCall = $.ajax({
        type: GET,
        url: url,
        data: {},
        success: function(data,status,xhr){
             return xhr
        },
        error: function(xhr,e){
             return xhr
        }
});
    if(xhr.status === 200)console.log('success');
}
So what i want is to treat the errors inside the function not after calling it and adding the callback in the call to treat those error for example, is this possible?
 
    