Simulate system error

Simulate system error

arnorbldarnorbld Posts: 110Questions: 20Answers: 1

Hi guys,

I have a datatable with the editor plugin. Once in a while or customers get "A system error has occurred" with a link to the "12. Editor: A system error has..." page. I'm implementing traps in the onSubmitError and onUnsuccessfulSubmit. I'm able to simulate the onUnsuccessfulSubmit error by changing one of the column names being updated triggering a SQL error.

I just need to be able to trigger a system error so I can trap it and present the additional information. Our users are not going to be able to deal with opening up the debug tools, etc. and these are intermittent and we can't duplicate them.

How can I trigger a system error so I can implement my event handler?

Best regards,

Answers

  • allanallan Posts: 61,710Questions: 1Answers: 10,103 Site admin

    Hi,

    To simulate that error just have the server return invalid JSON. If you want that under client-side control you could check for a query parameter in the URL and if found return invalid JSON (just put a a or something before your regular JSON).

    Regards,
    Allan

  • arnorbldarnorbld Posts: 110Questions: 20Answers: 1

    Hi Alan,

    So sorry for the late reply - got busy with other stuff!

    Here is the problem: This happens when the editor saves the cell data to the SQL database. All I do is provide the URL to the PHP Ajax handler in the editor setup:

    editor = new jQuery.fn.dataTable.Editor({
    
        table: '#task-and-po-table',
        formOptions: {
            main: {
                submit: 'changed'
            }
        },
        ajax:  {
            url: EditorAjaxURL
        },
    

    So I'm not doing any JSON at this point. I can simulate a SQL error by changing the name of one of the columns in the PHP editor handler and I've been able to trap that.

    But the SYSTEM error I don't know how I can simulate that.

    Best regards,

  • allanallan Posts: 61,710Questions: 1Answers: 10,103 Site admin

    EditorAjaxURL

    Whatever that is will be returning JSON. Do you have any control over that? Can you make it return invalid JSON?

    Allan

Sign In or Register to comment.