How to override the OOTB Product model error? - guidewire

Error : Configuration.ProductModel could not find package matching code for XXX coverage.
I have tried putting Try and catch block but did not work out-- any idea.

Related

anyhow: Return nested/wrapped errors

use anyhow::Context;
fancy_module::run()
.await
.with_context(|| {
format!("An error has been found")
})?;
From what I understand, when run returns an error, we return "An error has been found". But this message is not really meaningful. I would like to also return the error that run returns. Something like format!("An error has been found {}", e). How do I get e returned by run?
I could do that in multiple lines of code. By fetching the result of run and then having a match statement. Is there a nicer way of doing that?
From what I understand, when run returns an error, we return "An error has been found".
Not correct! context and with_context create a wrapper around the underlying error value to introduce additional context, but the original error is kept within!
Once you try displaying the error, you will see something of this sort:
Error: An error has been found
Caused by:
No such file or directory (os error 2)
(This also shows that "An error has been found" is a poor choice of words for creating additional context.)
I would like to also return the error that run returns. Something like format!("An error has been found {}", e).
That used to be a reasonable design decision in the past, but the current guidelines for error type design are against including the source error in the display message, unless that source error is also not reachable in the source error chain. The context methods will put the error in the source chain, so including that error's message into the top level error's message is ill advised.
How do I get e returned by run?
See the chain method in order to traverse the chain of source errors and so enable you to peek into underlying causes. Still, anyhow's error type was mostly designed to be opaque. If you need better introspection into what the error entails or easier pattern matching on errors, consider using a structural error type instead of anyhow::Error (snafu or thiserror can help you build them).
See also:
Should an Error with a source include that source in the Display output?
What is the difference between "context" and "with_context" in anyhow?
Simplier way to return custom error type with anyhow::Error?

How do I change what is printed when a Jest test throws an Error?

Basically, quite a few of my tests use some autogenerated code. And the autogenerated code often throws an Error with a meaningless message - but it has some other fields on it that are quite meaningful.
By default, when a test in Jest throws an Error, jest seems to print the error message. I'd like to add a different handler for a particular subclass of Error that prints the more meaningful text. This will help me determine why my tests are failing faster.
Any ideas would be great!

Undefined steps after running test from TestRunner class

I have a very strange situation, I have created Features and Scenarios in the feature file and corresponding step definitions and methods in the separate class.
I have run tests by running a feature file, and everything was fine, all tests were green.
But, when I run tests from TestRunner class, I got the following message:
Undefined step: Given I am on the Facebook Login page and suggested code.
You can implement missing steps with the snippets below:
#Given("^I am on the Facebook Login page$")
public void i_am_on_the_Facebook_Login_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
I have noticed that the suggested method have underscore:
(i_am_on_the_Facebook_Login_page())
but my methods do not have underscore
(iAmOnTheFacebookLoginPage())
Does anybody have an idea why this happens? I can't run tests now even from the feature file.
Recently, I have started using Mac and IntelliJ instead of Windows and Eclipse.
Is it possible that IntelliJ causes the problem?
P.S. I have used the option "Create step definition" from IntelliJ
ah...I figured out what the problem was...I forgot to put this piece of code
snippets = SnippetType.CAMELCASE
in CucumberOptions.
So, when I put this line of code here
#CucumberOptions(
plugin = {"pretty"},
features = {"src/test/resources/features"}, glue = {"/java/stepDefinitions"}, snippets = SnippetType.CAMELCASE)
everything works just fine.
It is possible your features folder is not in the build path (being a test folder) so Cucumber is unable to find it. Try this.

asp.net mvc5 scaffolding Unable to retrive metadata for ...Ambiguous match found

Problem: When I want to create controller from EF codefirst context it give me this error:
There was an error running the selected code generator.Unable to retrieve metadata for Model.class name.Ambiguous match found.
See Error Image
What I did?
As my model data was in seprate assembly I updated all package or downgrade them but nothing happened.
Then I merged my Model assembly in Website project but error doesn't resolved.
After googleing and many tricks, I created clean project and scaffolding for each class but it seems only one class had this problem.
In that class I commented all property and uncomment one by one to find error.
Found it! For this property error occurs public bool ISActive { get; set; }
I surprised so much and found how dot net turture you!!
What do you think about solution?!!
Renaming ISActive property to something else such as IsActivated solved my problem.It seems EF scaffolding has problem with this type of naming while cruding.

Hide linking errors when syntax errors are present

Syntax errors in a model might cause false linking errors because the referenced element cannot be parsed. These false linking errors distract the user and makes it very hard to diagnose the root cause. What we want is to hide XtextLinkingDiagnostic when XtextSyntaxDiagnostic is present in the model, once the syntax errors are fixed the linking errors should be displayed as usual.
I didn’t find any standard way to do it in the Xtext documentation. Thus, I went ahead and implemented a custom IAcceptor in ResourceValidatorImpl#createAcceptor() which removes linking errors from the list if it contains syntax errors. It works well, but I wonder if there is a standard/better way to do it than overriding ResourceValidator.
Thanks.
What do you think about displaying linking problems as warnings instead of errors. Your syntax errors will remain red and easy to find in the ressource, whereas linking errors will be in yellow as they are less important problems.
You only have to bind a custom LinkingDiagnosticMessageProvider:
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
return CustomLinkingDiagnosticMessageProvider.class;
}
Then you can implement it like this:
public class CustomLinkingDiagnosticMessageProvider extends LinkingDiagnosticMessageProvider {
#Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
DiagnosticMessage diagnosticMessage = super.getUnresolvedProxyMessage(context);
return new DiagnosticMessage(diagnosticMessage.getMessage(),
Severity.WARNING,
diagnosticMessage.getIssueCode(),
diagnosticMessage.getIssueData());
}
}

Resources