Uncatchable exception in ColdFusion? - exception

I stumbled upon a very weird issue in ColdFusion which might very well be a bug, but I wanted to post it here in case I was missing something.
It seems that cfindex is throwing an uncatchable exception when trying to index invalid files.
I'm not entirely sure yet what consists of an invalid file, but the issue occurs with a valid PDF file, but that doesn't have a PDF extension. Obviously, the problem can easily be fixed by adding a valid extension, but that's not the scope of the question.
<cftry>
<cfindex
collection="some_collection"
action="update"
key="//someserver/some_file_without_extension">
After index
<cfcatch type="any">
Exception caught
</cfcatch>
<cffinally>
Finally block
</cffinally>
</cftry>
Completed
When running the above code, the only thing that is output is Finally block, therefore it's like if there is an exception thrown, but which cannot be caught.
I even tried with type="java.lang.Exception", type="java.lang.Throwable" and type="searchengine" and nothing works.
The only way I found to detect such exceptions is to check a boolean flag in the finally block, but gracefully recovering form those errors is very cumbersome.
Another very weird thing that occurs is that right after the issue is encountered, if I refresh the page in the browser, I'll get the following error:
HTTP Error 503.0 - Server Error
The service is unavailable.
Module IsapiModule
Notification ExecuteRequestHandler
Handler JWildCardHandler
Error Code 0x00000000
Then after refreshing again, I get Finally block and if I keep refreshing the same behavior occurs over and over (Finally block then 503 error).

Related

Windows UIAutomation throwing confusing errors

I'm using Windows UIAutomation quite heavily and it works mostly well. But it's throwing some exceptions that I haven't been able to figure out.
The first of these is:
Exception thrown at 0x762D46D2 (KernelBase.dll) in MyApp.exe: 0x80040155: Interface not registered.
The offending section of code is the last line of:
IUIAutomationElementPtr element; //This is a valid element
IUIAutomationCacheRequestPtr cachePtr; //This is a valid cache pointer
IUIAutomationElement **first;
HRESULT hr = myControlWalker->GetFirstChildElementBuildCache(element, cachePtr, firstChild);
The second of these is:
Exception thrown at 0x762D46D2 (KernelBase.dll) in MyApp.exe: 0x40080202: WinRT transform error (parameters: 0x80040155, 0x80004002, 0x0000001D, 0x0565DB4C).
which happens at the same line of code as the previous.
And the last is:
Exception thrown at 0x762D46D2 (KernelBase.dll) in MyApp.exe: 0x8001010D: An outgoing call cannot be made since the application is dispatching an input-synchronous call.
once again, from the same line of code.
The program runs fine and it does what it needs to do, it just bothers me to have zillions of these exceptions being thrown left and right. Any suggestions?

Exception being generated from .net RSACryptoServiceProvider.Enrypt method

Every once in a while, at random times my software crashes due to a an exception with this message:
"Additional information: The runtime has encountered a fatal error. The address of the error was at 0x72938d57, on thread 0xe34. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
If there is a handler for this exception, the program may be safely continued."
It is begin generated from the .net RSACryptoServiceProvider.Encrypt method.
To take a look at it refer to https://github.com/HadiModarres/MRelay/blob/master/ConsoleApplication9/EncryptedRelay.fs line 94
my question is why is this happening and what can I do to catch exceptions that are generated from unmanaged code like this
Reposting from comment:
rsa.Encrypt is not thread-safe.

Errors within nested views always show a vague error message. Can it be made more verbose?

I'm using View Composers and nested views in general to build my layouts, and whenever any PHP errors are encountered, it always shows a generic Method Illuminate\View\View::__toString() must not throw an exception error message. Is there a way for it to show the actual error without having to guess what it is? Or is this limitation of PHP impossible to get around?
The error log also shows the same vague message, so that isn't a solution either.

AS3, Flash: Accessing error messages text in code

I'm working on some flash app. Now, to test customer side of it I can use Flash Player debugger version that will save logs and show error messages. When it's deployed on the customer side - they will have a regular Flash Player version which means I will have no access to error messages if errors will happen. So I would like to equip it with some tool that would capture all of my trace messages in code and errors text. As for trace messages that's fairly simple, I just override the function in my code so it sends a POST request with trace message to a logger server, but how can I get a hold of the error message? Is there a known approach to this or some trick that somebody can suggest?
You can install the debug version of flash as your browser's default (in Chrome, you must disable the built-in player), so if you wanted to test user experience and debug, this would be the ideal solution.
However, to answer your question: there's no method for universally catching all errors, and redirecting them (that I know of). You'd have to encapsulate problem code ahead of time with try...catch statements, and send the property back on catch. For example:
try {
this["foo"]();
} catch (e:Error) {
trace(e);
}
In the debug version, the traced value would be TypeError: Error #1006: value is not a function. And while the standard version will only output TypeError: Error #1006, (a notably less descriptive error), what we're missing is any reference to where the error occured. To get this, we need to use Error.getStackTrace() to see the call stack and the line where the error occurred. In debug, this outputs the following:
TypeError: Error #1006: value is not a function.
at Shell_fla::MainTimeline/init()[C:\Projects\shell.as:91
In the standard client, we get a dissapointing null. In short, you cannot get any valuable info from the client versions.
The best advice I can give is to write around your problem code with your own custom error reports. For example, catch IO errors and trace the file it failed to load, or if you're expecting an object.foo, first try if (object.hasOwnProperty("foo")) { // do something } else { trace("foo not found in " + object.name) }. Code defensively.
Cheers,
I've discovered this post on StackOverflow:
How to catch all exceptions in Flex?
It answers my question, strange that I haven't ran into it while I was googling prior to asking.

fail test on unhandled exceptions in Poltergeist

When I add some junk to application.js I get following error from Poltergeist:
Capybara::Poltergeist::JavascriptError: One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
However when I just throw and exception, it's ignored (and test fails because of page functionality missing). Can I make Poltergeist fail if page has unhandled exceptions? Or at least issue warnings?
That sounds like a bug to me - please report it on Github with steps to reproduce.