fail test on unhandled exceptions in Poltergeist - exception

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.

Related

What is the cause of FluentValidation Method Not Found exception?

I've got a Domain Driven Design solution and for some reason, I'm getting this exception at RunTime when the API call is made through GateWay:
One or more errors occurred. (Method not found: 'Void FluentValidation.AbstractValidator`1.When(System.Func`2<!0,Boolean>, System.Action)'.)
The error occurs as below:
I have solution like this:
The main 4 project I'm focusing on right now are:
Core.Model
Account.Api
Service.Api.Gateway
Web.ClientSite
Web.ClientSite makes request to Service.Api.Gateway which then calls Account.Api.
Note that Core.Model is referenced everywhere
VERY IMPORTANT: If I remove the reference of FluentValidation from Core.Model, the exception disappears.
I'm hoping these information is enough. Why do you think I'm getting this exception and how can I eliminate.
Looks like some of libs (ocelot) are incompatible with new changes in FluentValidation 8.1.2. Try to downgrade to FluentValidation before 8.1.2. Hope it helps
I got similar exception:
System.MissingMethodException : Method not found:
'FluentValidation.AssemblyScanner
FluentValidation.AssemblyScanner.FindValidatorsInAssembly(System.Reflection.Assembly)'
In my case I needed to upgrade the ediatR.Extensions.Microsoft.DependencyInjection and MediatR.Extensions.FluentValidation.AspNetCore packages as well to fix the issue.

lit-element : Uncaught (in promise) TypeError: Cannot read property 'previousSibling' of null

On migration to lit-element version 0.6.0. If I use
<script src="node_modules/#webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
in the header part of my document. I have the following error :
Uncaught (in promise) TypeError: Cannot read property 'previousSibling' of null
at NodePart._commitText (parts.ts:255)
at NodePart.commit (parts.ts:216)
at TemplateInstance.update (template-instance.ts:56)
at NodePart._commitTemplateResult (parts.ts:283)
at NodePart.commit (parts.ts:220)
at render (render.ts:48)
at Function.render (shady-render.ts:160)
at HTMLElement.update (lit-element.ts:44)
at HTMLElement._validate (updating-element.ts:600)
at HTMLElement._invalidate (updating-element.ts:574)
I couldn't trace where this error came from as the errors stack is huge and involves a lot of asynchronous calls. Also I tried to reproduce a minimal example, but same, I couldn't emulate the same error message.
The consequence of this error is a complete failure to load some custom elements (to the point the application is unusable).
Now If I change the header script with this one :
<script src="node_modules/#webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
The error just vanishes.. but now the following warning message appears in the console:
Incompatible ShadyCSS version detected. (shady-render.ts:42)
Please update to at least #webcomponents/webcomponentsjs#2.0.2 and#webcomponents/shadycss#1.3.1.
It's a funny message because my project is using webcomponentsjs version 2.1.2 and shadycss version 1.5.2 already.
Besides this warning message the css directives #apply are completely ignored resulting in an interface not using any flex properties (I let you imagine the mess).
Now this is a behavior I really can't understand even though I spent full afternoon digging into documentation and stuff. I summon your help.
There is a known issue with ShadyCSS that was introduced in 0.11.3, so that may be causing your problems with shady-render. I think the fix is already in so it should be resolved with 0.11.4
If you are using LitElement, you should probably be using lit-html version 0.11.2, which is what lit-element itself uses. Otherwise there's a reasonable chance that you are using two different versions, which may also explain some problems.
I can't reproduce your issues though: codepen.io/ruphin/pen/qMyMVO?editors=1010
The only explanation I can come up with is that webcomponents-bundle.js works, which triggers ShadyRender to be used, which breaks. When you switch to webcomponents-loader.js the polyfills don't work for some reason, which causes ShadyRender to not be used and explains why you don't get the error, but get the incompatible polyfill warnings, and don't get properly polyfilled CSS. I don't know why this is happening though, both versions of the polyfill should work, although I generally recommend using -bundle.
It would help if I knew on what browser/version you are seeing the problem.

Uncatchable exception in ColdFusion?

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).

How ColdFusion exception and 404 errors should be handled?

Today I was designing the error handling statergy for a new website. I have gone through all the docs for ColdFusion Excepiton
handling.
Now I have some doubts.
What the best solution for handling 404 errors?
Using onMissingTemplate() method
Sitewide Missing Template option(CFAdmin)
IIS custom 404 error handler.
What is the best solution for exception handling?
What should I use for error logging onError() method or Site-Wide Error handler? Is there any significant difference between
these two?
Do I need to use try/catch block for each and every query that I write?
Because there are some queries where I am sure the query will only fail when the database will fail. So if the database fails ,there is no meaning process the page further using try/catch. What should I do in these situations?
I know this question looks bit subjective , but I can not find a better place than StackOverflow for this.
For handling 404's, its better to handle it at webserver level.
For Sitewide Missing Template, you can specify the same in CF Admin. Ensure that the Sitewide error handler file location, should be relative to CF webroot and not webserver root. The dependent files may be put at the webserver.
Please refer to http://blogs.coldfusion.com/post.cfm/onmissingtemplate, for IIS custom 404 error handler. This recent blog post has a detailed description of 404 and error handling.
The answer is that you should use all three.
onMissingTemplate() is application-specific (remember that you can have multiple applications on a single CF instance).
Missing Template Handler is CF-instance specific.
IIS custom 404 error handler works for non-CF files (e.g., .htm, .html, etc.). You can still, of course, specify a CF template as the custom error handler.
FYI, the application-specific onMissingTemplate() method takes precedence over the CF Admin Missing Template Handler. The latter fires if there isn't an application-specific onMissingTemplate().
As far as exception handling is concerned, that is going to depend on a number of factors, but again a multi-layered approach is good.

ASP.NET MVC: “An internal error occurred.” when loading certificate bytes with X509Certificate2

I have already spent a few hours to resolve this error. The weird thing is when I use this libraries independently, it works absolutely fine but when I integrate them with my ASP .NET MVC website, it start throwing the following exception. I have also used MachineKeySet flag based on suggestion here but still no luck. Could anyone please help me to get rid of this exception. Thanks.
An internal error occurred.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.Security.Cryptography.CryptographicException:
An internal error occurred.
Source Error:
Line 194: if
(string.IsNullOrEmpty(p12FilePassword))
Line 196: certificate = new X509Certificate2(p12FileBytes, "", X509KeyStorageFlags.MachineKeySet);
Line 197: else
I found the solution here. Looks like a known issue. I used X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable flags together and problem disappeared. Other solution is to change the identity of applicationpool to LOCALSERVICE.