I use "Tempus Dominus Bootstrap 4" for time manipulation.
Today, I have been implement a function to clear all input values​when a certain button is pressed.
However, there is a bug in this plugin, it seems an error occurs when executing clear function.
But, I do not have a time to solve it now, so I would like to throw an exception and proceed it.
On the other hand, I am not feeling well that errors cover the console window.
So I want to throw exceptions only once at the first time.
So, I wrote the following code.
var errorStack = 0;
$('.btn_clear_daterange').click(function(){
  var target = $(this).data('target'); // e.g. ".daterange_fields"
  $(target).each(function(){
    try {
      $(this).datetimepicker('clear');
    }
    catch(e){
      errorStack++;
      if(errorStack === 1){
        console.warn("clear function has a issue. \n check the follow link: https://github.com/tempusdominus/bootstrap-4/issues/34");
        console.error(e);
      }
    }
  });
});
I hope to do like this.
$('.btn_clear_daterange').click(function(){
  var target = $(this).data('target');
  $(target).each(function(){
    try {
      $(this).datetimepicker('clear');
    }
    catch(e){
      return e;
    }
  });
  if(e && e.count === 1){
    console.warn("clear function has a issue. \n check the follow link: https://github.com/tempusdominus/bootstrap-4/issues/34");
    console.error(e);
  }
});
How can I do? thanks.
 
     
    