Project Reactor 2 stream merging except both has errors - project-reactor

I have an application created using Micronaut, Kotlin & Project Reactor.
I have two get api calls inside the application using ReactorHttpClient.
API1 Say getCurrentPayment this can give some 4xx errors or in success case a Mono<CurrentPayment>
API2 Say getPaymentHistory this can give some 4xx errors or in success case a Mono<PaymentHistory>
I am building a function which combines these to a Payment Object. Requirement is that if one of the api gives 200 , the combined object should have the success response with respective content.
If both failed, then only, I could respond with an error from either of them.
I tried with zip operator, but it fails if any of the one pipeline error out.
How can I combine these 2 streams such that error in either of stream should not affect the combined one and only combined one should fail if both stream has error?

Related

Missing or Invalid Url Parameter with Twitter API

I am using the Twitter API's Search Tweets endpoint (https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets) to search for tweets on a particular topic. My application is written in Java and uses Twitter4j. I follow the guidelines (i.e. no more than 180 calls per minute and no more than 500 characters per query) however I do have a test case that has 50 word exclusions (so the total character count is 397). My test program also runs 100 such searches in rapid succession though, like I said, I observe the rate limits strictly.
The odd behavior I'm seeing is that the test runs fine and gets results initially, but after an arbitrary period of time, I start getting the following error:
Message: Missing or invalid url parameter. 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
message - Missing or invalid url parameter.
code - 195
The error message confuses me because I'm not trying to perform any of the update actions listed in the link provided. I'm just searching tweets. I'm also not sure what "missing or invalid url parameter" means. Is a query parameter missing from my request? The only required parameter is the query itself which I am definitely passing. The url is definitely correct unless Twitter4j is generating incorrect urls. So what does this message mean?
When I stop and restart the search (i.e. the max_id and since_id values get reset to -1, the searches start working again...for a while. As far as I know, nothing else about the search changes when it is restarted. Just those two ids.

Proper way to return error from within a mutateAndGetPayload

I am doing a number of business logic checks within the mutateAndGetPayload function of a relay mutation using the graphql-relay library. For any of these checks that fail I have an else clause that will throw an error, ig throw('You do not have permission to delete this resource');, however, when that happens, I get the error Cannot set property 'clientMutationId' of undefined returned to the frontend instead of the error I'm trying to return. It seems that I'm seeing this error because I'm not returning something this mutation cares about (or a promise that resolves to one), so I'm a little stumped ... what's the proper way to throw/return errors back to the client here?
One way is to use the GraphQLError Type
Working in NodeJS on the back end we have used the following library:
https://github.com/graphql/graphql-js/tree/master/src/error
However, what we have ended up using is a library that provides more flexibility:
https://github.com/kadirahq/graphql-errors
Either of these would be the best place to start.

Handling of batch requests in SAPUI5 with sap.ui.model.odata.v2.ODataModel

If I change a property of an OData entity to an invalid value (SAPUI5 client) and send that value to SAP Gateway Server using submitChanges I got the following message in the log file:
Service returned messages for entities that were not requested. This
might lead to wrong message processing and loss of messages
Now I would expect that the callback for "error" would be called but it is always "success".
Inside the callback for success I have a list of responses (in this case with an error).
Now I am asking me, why the error callback is not called?
I assume because the overall batch response is most of the time "OK" also if one request of the batch contains an error?
So do I have to implement error handling in the success callback? Or should the server send an overall error response?
I am using SAPUI5 1.28.15 (with 1.30.6 at least the cited message seems to be removed) and switched batch mode to "on" (if batch mode is off, callback will not be called!).

How do I know which IBM iLog.NET rules are getting hit during execution?

I'm using the IBM iLog.NET business rule engine (v7r1 or thereabouts) and I can't find why my rules are failing. How do I trace down what's failing, where, and why?
I've got a local object model that's calling out to my rules hosted in an IBM rules service on IIS 6.0.
About half of my rules are configured to modify one of the input objects with a new status code. The code isn't getting set when I think it should but I cannot tell conclusively which rules are getting hit.
I found that the IBM iLog.NET documentation had the answer buried deep, deep within. Persistent Google searching revealed that I can set ILOG.Rules.ExecutionServer.Trace.EventFilterCategories on my ExecutionRequest object before I send it to the server.
ExecutionRequest request = new ExecutionRequest(rulePath);
request.TraceFilter.EventFilters
= ILOG.Rules.ExecutionServer.Trace.EventFilterCategories.All;
...
ExecutionResponse response = session.Execute(request);
ILOG.Rules.ExecutionServer.Trace.Trace trace = response.Trace;
Debug.WriteLine(trace.SerializedExecutionTrace);
The serialized trace contains all the inputs and outputs for the call as well as all rules that were triggered during execution and the rules that weren't hit at all.

Customizing All errors symfony 1.4

Sorry for my English and writing through a translator.
I'm new here and I'm a bit lost in what I want, maybe you can help me out if they wish, as explained here:
I want to customize all the errors that may be produced (any status code that is a mistake. 404, 500, 204, 301 .... etc.) And also show suggestions based on the "module" and/or "action" from where the error occurred.
I also wish I could tell by the file redirection "setting.yml" application, something like this:
error_404_module: common
error_404_action: errors
error_500_module: common
error_500_action: errors
error_204_module: common
error_204_action: errors
error_301_module: common
error_301_action: errors
........
Within the "app/frontend/modules/common" in the "action.class.php" define "executeErrors" in which I receive the status code that has occurred and the module where the error occurred or except for well, getting partial show "app/frontend/modules/common/templates/_errorXXXSuccess.php" and the partial of the suggestion that I seek and extract the module "referer" where the error occurred.
Well, that's the idea, dynamic content for different types of error in different circumstances and working perfectly with the type codes 404 but not with the rest ...
I read that could place me in the middle of the event by creating a file "config/error.html.php" and "config/exception.html.php". Indeed if I produce such a 500 error and manually these files are executed. The problem is that from there I can not access variables from symfony. Because if so I could invoke "common/errors" and bad send as parameters the error status code and the module where it occurred, but it is not. From there all I can do is play with $ _SERVER and routing.yml but can not get good results because the environment is mixed with Development Production (/frontend_dev.php) and is something I also want to avoid.
That is, I want to get as in "setting.yml" does "error_404_module" and "error_404_action" but with different error codes. Thus allowing me to show my custom pages in production based on "error or exception" and/or "module or action" where the error has been released from production, and in case of being in development mode (/frontend_dev.php/....), show the symfony Dispatch.
Surely life is complicandome and has a simpler way to do what I want but after thousands of combinations do not get the right result. Even if symfony may not allow other types of error redirect from "setting.yml" is because they are reserved for him or something. I do not understand.
Please please help me because no documentation to find and secure here at least we left public for others who want to do something.
Many Thanks and greetings!
First of all - you can't get symfony to intercept all errors. Some of the errors may be server errors and the request won't even get to your application. You can reproduce some of them explicitly setting responses in symfony though, but I may not be necessary to deal with all of them.
As for the exact response: you should use a listener to hook your errors to a class that handles them according to your need. See: https://stackoverflow.com/a/7077818/580167 for implementation details.

Resources