How to deal with error handling

How to deal with error handling

jadeite1000jadeite1000 Posts: 9Questions: 7Answers: 0

Hi All:

I am new to datatable.
I am using server side datatable.
I have an exception on the server side.
On the server side I am using Spring MVC:

public DataTablesOutput<ZSDCPEDDETAILEDINVOICESS> listData(@Valid DataTablesInput input, Model model)

{
    DataTablesOutput<ZSDCPEDDETAILEDINVOICESS> dataTable = new DataTablesOutput<ZSDCPEDDETAILEDINVOICESS>();

    try 
        {


                dataTable = webHelper.getInvoices(input);


        }
        catch(Exception e)
        {
            logger.error("InvoiceController Exception", e);

            dataTable.setError(e.getMessage());



        }


    return dataTable;
}

When there is an exception I am getting the message "Processing" on the front-page.
This word "Processing" seemed to keep going.
Is there a way to make it stop?

Here is my html code:
function initDatatable() {
return $("#invoiceList")
.on('xhr.dt', function(e, settings, json, xhr) {
/*
if (json.recordsTotal >= 10) {
$("#btnAddUser").prop("disabled", true);
}
*/
if (json.recordsTotal >= 0)
{
console.log("invoice currency type:"+json.data[0].waers);
$("#currency-Info-Big").show();
$('#currency-Info-Small').html(json.data[0].waers);
}

                })
                .DataTable({
                    "searching": true,
                    "processing": true,
                    "serverSide": true,
                    "responsive": true,
                    "rowReorder": true,
                    "autoWidth": false,

                    ajax: {
                        url: "./invoice-list-data",
                        type: "GET"
                        , error : function(xhr, textStatus, errorThrown){
                            lh.ajaxUtils.handleAjaxError(xhr, textStatus, errorThrown);
                        }
                    },

                     "lengthMenu": [[5, 10, 25, -1], [5, 10, 25, "All"]],
                    "lengthChange": true,

                    //Loader code
                    oLanguage: {
                        sProcessing: "<div id='loader'></div>" 
                    },

                    "pageLength": 10,
                    "lengthMenu": [
                        [5, 10, 25, -1],
                        [5, 10, 25, "All"]
                    ],

                    "language": {
                        "url": '../../datatables/i18n/messages_en.json',
                    },

                    "dom": '<"top">rt<"bottom"ipl><"clear">',


                    columnDefs: [{
                        targets: [4],
                        "className": "dt-center"
                    }],
                    "order": [[2,"desc"]],
                    "columns": [

                        {

                            "data": "", orderable: false, searchable: false,
                            render: function(data, type, row) {
                                    return '<div  style ="text-align: center; width: 100%" ><input  type="checkbox"></div>';
                                }
                        },
                        {
                            "data": "invoicenumber"
                        },

                        {
                            "data": "invoicedate"
                        },      
                        {
                            "data": "duedate"
                        },  
                        {
                            "data": "openbalance",
                            "className": "text-right",
                                render: function(data, type, row) {

                                    return "$" + parseFloat(data).formatMoney(2, '.', ',');


                                }
                        }, 
                        {
                            "data": "originalbalance",
                            "className": "text-right",
                            render: function(data, type, row) {


                                return "$" + parseFloat(data).formatMoney(2, '.', ',');

                            }
                        }, 
                        {
                            "data": "status"
                        },
                        {
                            "data": "searchByDate","visible": false 
                        },
                        {
                            "data": "dateRangeFrom","visible": false
                        },
                        {
                            "data": "dateRangeTo","visible": false
                        },
                        {
                            "data": "searchByNumber","visible": false
                        },
                        {
                            "data": "numberField","visible": false
                        },
                        {
                            "data": "waers","visible": false
                        }

                        ],
                        columnDefs: [
                            { targets: '_all', defaultContent: '' }
                        ]
                });
        }

Any hint or help would be greatly appreciated it!!

This discussion has been closed.