How to display errors to client?

Dataprocessor.senddata() did not succeed and rows on grid are not inserted/updated but I don’t get any message explaining why this happened.

What do I have to do in order to display in my webpage that there was an error with the sql?


on client side

dp.attachEvent("onAfterUpdate", function(sid, action, tid){ if (action == "error") alert("Something bad happens"); });

By default, server side doesn’t provide any extra info about errors. For dev. purposes you can enable logs in server side code - which will provide details about errors.

It possible to customize server side code and include some more info about error in the response.

Thank you very much for the reply.

For dev purposes I have already checked the log functionality. The error is written in the log file but I was looking for a way to notify dataprocessor about it.

Are there any docs or examples on how we can customize server side code so that we can at least return to dataprocessor the error given by MySQL?


you can modify connector/dataprocessor.php

line 158

} catch (Exception $e){ $action->set_status("error"); }


} catch (Exception $e){ $action->set_response_text(mysql_error()); $action->set_status("error"); }

Thanks a lot, that worked fine.

Although it would be much safer if we didn’t have to change dataprocessor.php code but just somehow extend it, just like you mention in … principles that we can define our own error somehow.

If changes are made in dataprocessor.php then extra caution is required to “redo” these changes when any updates are released from your side.

Just to complete the topic and make it easier for others that might need the same:

In client side i did the following:

function sql_error(node)
           return false;


Although it would be much safer
Yep, it was missed in the existing design, most probably we will add some kind of onDBError event in next version, so the same scenario will be available without code modification.

Thanks for this, good example. Can the same structure be used to show success message from the connector, from the php I have

	if (mysql_query($InsertSQL))
	else {
		$action->set_response_text("Error InsertingTask [$InsertSQL], Please try again");

on the client I put


function sql_error(node) {
return false;

function sql_success(node) {
return true;

In case of an error it works fine and displays message, but is not working for the success return…

Are you sure that “update” is what comes back?

According to : … inciples&s[]=my_error

There are 5 predefined actions:

There are 5 predefined types of response:

Could it be “insert” or “delete” ?

Try sending insert & delete to “sql_success” and see.

Unfortunately the docs aren’t very clear on how to handle these actions and I am also a bit confused with them.

Ooops, where is “set_response_text” for the success case?

very clear on how to handle these actions
All default actions already has their logic as part of dataprocessor ( so row will be marked or deleted automatically ) You can attach custom handlers for such actions , to add some extra reaction, but need not care about default processing.