Custom error message when function not true

i would like to edit the error message that displays when an argument is ‘invalid’ on my form.

at the moment if the journey is ok then the ‘book now’ button becomes visible and the forms is ready.

The function outputs the following response
The Cost of the Trip is £X.XX

if the journey is NOT ok then it currently displays a specific error taken from an attribute in my database. for example:
Invalid Job Charge “Driver Gets”

i am quite certain that the function that produces these responses is this:

var ProcessQuotation = function(transport)
{
    var response = transport.responseText;
    Validate(4, true);
    <% if (!!Session("SuppressChargesBeforeBooked")) { %>
    if (response.indexOf("Error") < 0) response = "Ready to Book";
    <% } %>
    document.getElementById("Quote").innerHTML = response;
    <% if (Session("User").IsNewUser) { %>
    document.getElementById("BookNow").style.visibility = "visible";
    <% } %>
}

If i wanted to customize the ERROR (false) response to read ‘this job is invalid, please call the office’ (for example), how could i do that in the above.

thanks

You would need to encapsulate the code in your function within a try/catch expression. In the catch area, you can invoke an alert to notify the user of the error that occurred.