Search Support
-
Andrzej MichalecNovember 10, 2016 at 4:36 am #3026
Dear SPARK team.
I have single select (4.4.4EE) that has configured AJAX service. AJAX returns error that is clearly visible in POST response JSON on Net tab in inspector.
1) The “on service error” handler is not called when AJAX returns error, neither when call is initiated by widget nor when reloadServiceItems() is called — I believe this is a bug.
2) Assuming (1) is working, is there any automatic variable e.g. “error” in scope of “on service error” handler, that is holding error returned from AJAX (same as “me” or “page” available in formula)? I would like to track back issues saying “console.log(error)” from this handler.
regards,
-andy.SPARK SupportNovember 16, 2016 at 9:01 am #3080Andy:
I am unable to reproduce the results you report in (1) above. If my Ajax service throws an error the On Service Error is always being called for me when running 4.4.4EE.
With regards to (2) there is currently no variable that contains the error.
Regards
JMAC
Andrzej MichalecNovember 17, 2016 at 6:27 am #3095Hi,
I tried also 4.4.5EE and (1) still does not work on my site. I think attaching my sample project here is not an option as SPARK UI toolkit would be exposed as part of exported TWX. Can you send me your sample project ? Or if you provide me an email I can PM you.
Meanwhile take a look on screenshots attached from my sample. I have echo AJAX service that returns input on output after making it upper case. Also that AJAX is returning (not throwing) error if input is “ERR” literal. This way I can test correct results and AJAX errors. AJAX is bound to single select and its input parameter to input text: whenever I change input text, this becomes upper cased single value in dropdown of single select. Until I enter “ERR” that leads to planned AJAX error. In turn it should lead to message to be logged on console – and it does not happen! Also any other code placed inside “on service error” is not executed (e.g. “debugger” as I tried to stop and look for data passed to handler).
To summarise, I cannot make it working, please provide me detailed guidance or sample project.
regards,
-andy.jmacNovember 17, 2016 at 8:14 am #3099Andy:
It seems to me that you must have defined the error variable as an output, and the Ajax Service is returning normal. So in that case I would not expect the “On Service Error” to be triggered. I imagine if in your catch you threw tw.local.error, it would then trigger the “On service Error”. I understated, that you do not want to do this, I am just trying to ensure that I understand your issue. Essentially my sample is identical to yours, except that when I detect the input of “ERROR” (“ERR” in your code) I throw an error. Assuming I am correct in what I have said, what you are looking to do would require a change to the variables defined for the Default List Items Service to add error as a possible output. SPARK does have this in the Service Call control, but not in many other controls that call an AJAX service. This would have to be a feature request we would add and consider in a future release of the toolkit.
Regards
JMAC
Andrzej MichalecNovember 18, 2016 at 2:26 am #3110Indeed when AJAX throws exception then handler is triggered, fine but…
let me start from the very beginning. See attached screen what happens when AJAX does not handle issue and simply throws exception – console has reported 2 errors, first is server side 500 and then cryptic non-stingified dojo error [object Object]. Our policy is to have console clean w/o errors, and I believe Salient deliberately introduced AjaxError to be returned from AJAX service to serve that purpose (am I right?). Then handler says exactly “on service error” suggesting handling error returned. Note that it not not said “on ajax exception” or “on service exception”… so I see dichotomy becase we have both errors and exceptions. If I return SPARK-specific AjaxError, why, for sake of consistency ,the Single Select does not handle it?
Treat my report as you wish, either bug or ehancement request. I simply plead for keeping SPARK behavior as intuitive as possible. If it helps you, please open a ticket of behalf of my client to do both:
1. make sure that AjaxError and unhandled exception is delegated to “on error handler”, and
2. pass error object as parameter to error handler to be able to make contextual decisions if necessary.regards,
-andy.jmacNovember 18, 2016 at 6:57 am #3116Andy:
I appreciate your comments, being as intuitive as possible is a goal.
I have opened a feature request to have all ajax calls support the “AjaxError” in a manner similar to how it is done in the Service Call control.
Regards,
JMAC
-
|
You must be logged in to reply to this topic.