DirectWebRemoting errors - dwr

I am supporting an application that has some DWR components. Whenever there is a server error i get a javascript alert that simply says 'error'.
Does anyone know where this might be configured and if there is a way to disable this. Id rather it silently fail at whatever then do this very distracting message.

Use DWR exception handlers in the positions wherever there is a chance for run time errors.
Use try catch mechanism and printstacktrace() in catch block. It works for me!

Related

How to catch parse errors in PHP?

I`m writing a light PHP framework for learning purposes and I came up to a problem. In famous frameworks like Laravel for example, all errors are caught and displayed in a custom mode. I know that I can setup custom errorHandler and exceptionHandler for my application like this:
set_error_handler([$handler, 'errorHandler']);
set_exception_handler([$handler, 'exceptionHandler']);
I can even setup shut_down function in order to catch the fatal errors and in combination with error_get_last() I can throw them as exceptions.
register_shutdown_function([$handler, 'shutDownFunction']);
Then problem is that I cannot catch parse errors. It seems none of my handlers are catching a parse error.
Is there a way to do that? Please help.
In php 7 parser errors handled with set_error_handler callback.

No ajax action fired after session invalidate

We have a JSF webapp with Primefaces 4.0 and CAS Single Sign On.
When a user requests an ajax action (by clicking a p:commandButton or similar component with ajax=true) after he has lost his session because SSOut in another tab, nothing happens, no response from server or action is triggered.
We need to manage that situation to inform the user that his session is no longer available, by showing a dialog or redirecting him to home or a custom page, but we don't know how.
ajax=false solves the problem, but this is not what we want to do.
No ViewExpiredException is thrown.
EDIT:
We had already read and tried this BalusC's solution without success. No Exception is thrown and Handler has nothing to do. Note that isn't an Expired Session or Invalidated by TimeOut session, is just an explicit session.invalidate caused by Cas Sign Out in another tab.
We also tried javascript jsf.ajax.addOnError() solution, and again nothing to capture.
Only p:ajaxStatus onError event catches something, but no way to identify that particular error. Even overriding ajaxStatus javascript function, error data parameter is undefined...
Also, p:log says "Request return with error:error." but, which error is it? how do we identify it?
We are stuck on this issue...
This has been discussed many times, and as far as know there aren't any out-of-the-box solutions yet. One solution is to add a custom ExceptionHandler as stated in this post.
Another option is to register client error handler using jsf.ajax.addOnError(...), and to handle this exception in it. You might need some server code to add a custom header in case session is invalid, which you would use in error handler to be able to differentiate that specific case from other errors.

Codeigniter global error override

Is there a way in Codeigniter to override global errors. For instance if an DB error or PHP critical occurs it wont show the error itself but something like 'Our admin guy is fixing the issue' and the error is just logged and emailed.
Codeigniter lets you handle error messages your way, depending on the HTTP status.
Refer to this documentation on error handling
In addition to #Pos5e5s3dFr3ak's answer, you should handle as many errors as you can manually. For example, if you have a database error, your code should acknowledge (or 'catch') it and perhaps load the appropriate view, or pass it onto a library that will log an email the fault, instead of displaying the intended result.
This method can be used as an alternative, or as an addition to the original answer - sometimes you need not locate the error just by its HTTP response Status Code.
As an example, you may find that the database engine in use is down. If this is the case (you would have to determine if it is indeed down - ie. you are not getting the desired response), you would pass the user on to example.com/error/database, for example.

Displaying Error Page in WP7 app

Just want to check I have not missed anything obvious. There is no way to Navigate the user to a "ooops something bad has happened" page from the UnhandledException handler is there?
What is everyone else doing
I know I can "handle" the error and popup up messagebox but I would prefer a whole page offering them the oppurtunity to file a bug report.
The samples I have seen simply set the RootFrame directly but I have seen that just makes for a messy UI with what looks like a Page displayed on top of another page
TIA
Pat
If you get an UnhandledException it occurs while your applicaiton is about to be shut down. The best you can do in this situation is warn the user that something went wrong (using a messagebox or similar) but be prepared that this may not be displayed to the user for long, depending on the actual exception.
Rather than try and continue executing application functionality when an unhandled exception occurs, simply save the details of the exception. Then, when the application is next started, display a message to the user to indicate that "the last time that app ran there was a problem". You can also use this opportunity to send exception details to yourself/ your web reporting service so you can analyse the issues and fix/prevent them in a future version.
You can call RootFrame.Navigate(your errorPage) to navigate to your custom error page in the UnhandledException handler.
Basically, using a custom MessageBox to show a nice easy-going error info and providing an button to send bug report is very common. And this article is MSDN pointed out that errorinfo not be a separate page in best practice.

How to watch for UNHANDLED exceptions only using WaitForDebugEvent family functions?

I'm trying to catch unhandled exceptions in the application and restart it on them using WaitForDebugEvent function. But I can't tell when exception is handled by application (try..catch for example) and when is not. How do I do that? There seem to be no such data in DEBUG_EVENT structure.
If your not catching certain exceptions using WaitForDebugEvent, you might want to try injecting an UnhandledExceptionFilter as well. other than that, check that your processing matches Microsofts Example
In the EXCEPTION_DEBUG_INFO structure, which is in the DEBUG_EVENT structure, there is a field dwFirstChance:
If the dwFirstChance member is nonzero, this is the first time the debugger has encountered the exception. Debuggers typically handle breakpoint and single-step exceptions when they are first encountered. If this member is zero, the debugger has previously encountered the exception. This occurs only if, during the search for structured exception handlers, either no handler was found or the exception was continued.
So you will want to look for times where dwFirstChance is 0.
But if you just want to restart your app when it fails, it might be easier to create another app to watch for the failure of the first one, rather than using the Windows debugging api.

Resources