My scenario is that suppouse for now I have a function abc() which has a return type of Future[Unit](or it can also have a return type ) , now someone has given me a task that if this abc function failes it just print a logger statement and that's it , it should not fail the parent function inside which it is wrapped around , and he also recommended me to use Future.onFailure . Now what I have tried is
abc(some , random ,code ).onFailure(e=>{
logger.debug("I don't want to through error : ${e}")
})
But intellij is showing me this
I am not able to understand what does this error means ? What should be way out for this ? And if possible please explain more about onFaiure in Futures with examples
Thanks in advance
Related
Running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title?
PROGRAM PLC_PRG
VAR
itfAxisRef : SM3_Basic.IAxisRef;
pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3;
END_VAR
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer;
Trying to compile the above throws the following error
C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3'
which has me really confused because I've never seen the type GETAXISREFPOINTER before and the documentation for .GetAxisRefPointer states that it returns POINTER TO AXIS_REF_SM3
https://help.codesys.com/webapp/3dvrBKsuKjYfmeP1KzrJnylfstc%2FGetAxisRefPointer;product=SM3_Basic;version=4.9.0.0
As for why I'm trying to use this method, I'm trying to loop through the array of axes in SM3_Robotics.AXIS_GROUP_REF_SM3 and pass them to SM3_Basic.MC_ReadStatus in order to get their individual SM3_Basic.SMC_AXIS_STATE (not only the SM3_Robotics.SMC_AXIS_GROUP_STATE) for debugging
Is there a better way to achieve the above without using the axes array?
GetAxisRefPointer is a Method, try:
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer();
im really new to scala and gatling testing. What im trying to do is to extract parameters from response and save it to some session variabels. I want to pass map with variable name, and variable path to be extracted.
if(req.method == "GET"){
scn.exec(http(req.url).get("/uri").check(checkIf(!req.additionalParameters.isEmpty){
for(par <- additonalParameters){
jsonPath(par._2).saveAs(par._1)
}
}))
}
Im was trying something like this, but it dosen't compile and im wondering if it's even possible to do.
Thanks for all the help :)
That's not possible this way atm (as of Gatling 3.3.1), checkIf second parameter takes one single value. You need one checkIf per check.
I'm new to Gatling and Scala, and I had a hopefully quick and basic question about how to access the elements that are saved as from a findAll in the previous request.
The regex in the below code matches multiple button values. I eventually want to find the "max" button value (by something I'll come up with later), and based on that use that button in subsequent requests. However, I'm unable to actually access the values in button_list. In the terminal when I try to print the values, the values don't get substituted and literally print like this for each button:
Button ${count}: ${button}
Button ${count}: ${button}
Here's the snippet producing this:
...
.exec(http("click_ok")
.post("www.foo.com")
.headers(headers_0)
.formParam("_flowExecutionKey", "${flow_execution_key}")
.formParam("_eventId_submit", "${_eventId_submit}")
.check(regex("""foo(.*?)bar""").findAll.saveAs("button_list"))).exitHereIfFailed
.pause(1)
.foreach("${button_list}", "button", "count") {
exec(session => {
println("Button ${count}: ${button}")
session})
}
...
When I see the session print out in the logs, I can see that the buttons have matched and the session contains a list like the following, so I know there are successful matches:
button_list -> List(c11/98/280, c11/98/390)
Anyone have an example or know what I'm doing wrong?
Thanks!
As explained in the official documentation, Gatling Expression Language is not something that magically works anywhere. It only works when passing such String to a Gatling DSL method, not in your own code. You must use the Gatling Session API.
I'm trying to resolve one problem referred to protractor getText(). I have a code which finds successfully an element:
var $editTrigger = $('[ui-view="hcp"] .m-pane__control__trigger');
then execute a line that works too:
expect($editTrigger.getText()).toBe('BEARBEITEN');
but if I execute this
console.log('---> $expectTrigger' + $editTrigger.getText());
what I get it's: [object Object].
Why? Why don't I get 'BEARBEITEN'? This has happened to me several times and I don't know what do I do wrongly.
If you need more information to evaluated this case please feel free to ask for it. Thanks you
getText() is an promise. the console.log will be executed long before the value from getText is returned. If you write it like a promise it works.
$editTrigger.getText().then(function(text){
console.log(text);
});
The expects work because they now they are working with a promise and wait for it to complete.
I get the error
Variables can not be used inside bindings
on the following Drools-Rule Code
rule "minGapsBetweenAppointments"
when
$leftAssignment : AppointmentRequest(feasibleAppointment != null)
$totalValue : Number( ) from accumulate(
AppointmentRequest(feasibleAppointment != null,
$leftAssignment.requestId != requestId,
$quality : this.getOccupiedSurroundingsValue($leftAssignment)),
sum( $quality )
) // ERROR LINE
then
scoreHolder.addSoftConstraintMatch(kcontext, $totalValue.intValue());
end
Although i found this post from another question, it's not helping me much, as I need to call function getOccupiedSurroundingsValue for all other AppointmentRequests, as they're related.
Any help appreciated.
That code should work. There's nothing wrong with it as far as I can see.
Double check if you it's exactly the same as the code you're executing it. I use similar code in my examples and those work.
If it's OK, then it might be a bug in Drools Expert.
There are 2 ways to proceed:
The easy way: repost this question on the drools mailing list, maybe Edson or Wolfgang sees something I don't. Post a jira if no one sees a user-mistake.
The fastest way to solve your problem: create a new test in MiscTest that proves your case and submit it as pull request. Either you find out what you're doing wrong or you prove without a shadow of a doubt there's a bug we need to fix asap :)