Logic apps cannot handle 'Bad Request' - azure-logic-apps

I'm new to Azure Dev. Trying to check statuscode after generating a request in an 'if' condition. It works fine when I get 200. However, it fails when I get a 400.. Code view looks something like this:
It is a bit weird why I couldn't catch 400. I have seen another way to do i.e. to configure 'RunAfter' and then handle the error but need to know what's wrong with my approach here.

You need to enable configure the runafter to run even after the whole workflow is getting failed.
This is how it worked for me. Go to your work flow and click on Menu for that particular action that you want to run even after the before action is about to fail/ timeout/ skip. In your case it is Condition and then click on Configure run after.
Here is how my code view looks like
OUTPUT:

Related

Network calls show Error Message on Screen with setFailSilently()

I'm using the network calls and adding the following statements before reading the response.
r.setReadResponseForErrors(true);
r.setFailSilently(true);
NetworkManager.getInstance().addToQueueAndWait(r);
I don't want to show network error on Mobile App to the user but want to read the response code and perform the operation accordingly. Does this order matters? or do I have to setFailSilently() before setReadResponseForErrors? Please advise.
Thanks
You've mentioned this in another question where I literally quoted the code of fail silently...
You probably have a network manager listener probably in your init method where you show a generic error. That's part of the application boilerplate code.

Easy Django REST Framework Websocket Usage

I have a an application that uses Angular for the frontend and communicates with an API running Django RF.
Now, let me try and outline what I'm trying to achieve in hopes of finding an easy solution.
When a user runs a report, a worker version of the API generates the report to prevent the main API from bogging down. The report runs for a couple seconds/minutes. The user refreshes the page and voila, their report is there.
What I'm trying to achieve is the elimination of the whole "user refreshes the page" portion of this process.
My goal is to do this via websockets.
I literally want something as simple as:
WEB: "Hey API, I want this report. I'll wait."
API: "Yo dog, you're reports done."
WEB: "Cool, let me refresh my report list. Thanks bud."
Now, we start to venture into an area I'm unfamiliar with. Websockets can do this, right? I just need to create a connection and wait for the all-clear to be sent by the worker.
Now, here's where it gets hairy.
I've spent the better part of the day going through libraries and just can't find what I need. The closest I've come is this, but it clashes with restframework. I get hit with tons of 404 errors and I think it has to do with the way rf manages urls.
I literally need a simple event listener. There's got to be a better way, right? To clarify, I don't want to do something brute-force like silently ping the API for report status. That gets a tad hinky. I want the API to tell me when it's ready.
In a basic way, can use something like django-websocket-redis and use Django signals to pass the messages around. ws4redis handles alot of the tricky bit. However, websockets are weird and honestly I doubt you need them. You could just poll some route that has the job state. If you need to get it done fast, I would go that route.

Strange, isolated errors "$compile:tpload"

We're having strange, sporadic JavaScript error messages in our production log files (JavaScript errors are logged in the backend):
Uncaught Error: [$compile:tpload] http://errors.angularjs.org/1.2.16/$compile/tpload?p0=modules%2Fsome%2valid-directive-path.tpl.html
The error occurs only with directives. I'm not able to reproduce the errors locally. The templateUrl for the directives are all valid.
The only possible scenario that came to my mind was if the user presses the cancel/stop button in the browser while the page is loading (then i'm able to reproduce the error).
Does anyone have another idea or explanation? Or even a solution :-)
Cheers
Michael
We resolved the issue like this:
Since we are caching our HTML templates with $templateCache using the grunt ngTemplate plugin (https://www.npmjs.com/package/grunt-angular-templates) we do not have the above issues anymore.
Out of interest I was able to recreate this issue. By adding logging to angular I established that when the template load fails it does so with a status of 0 which made me think that the request was actually cancelled. This theory was backed up by the fact that we see no server side errors.
If I emulate a device that cannot support html5 routing and then add an arbitrary query string to the end of the route, it causes an infinite digest loop and in the end the whole page reloads a few times. This in turn was causing the outstanding template requests to be cancelled leading to exactly the errors I was seeing in the logs.
So, for me at least, this is really nothing to do with the loading of the templates, it's just an angular bug (which hopefully is going to be fixed in angular 1.3.8)

CodeIgniter Check for Database Connection and if Session Library is Loaded

Two questions:
Is there a way in CodeIgniter to check if a library had been loaded? If the session library is loaded, I want to show a user-specific page.
If my database is offline and CodeIgniter is unable to connect, how can I display a custom message to users rather than the default error page?
Don't know if this is best (or even good) practice but I found using something like
if(isset($CI->session)):
//show user specific page
endif;
works for me so far, eg. the last 5 mins since I tried it =). In my case I didn't want the debug message:
Session class already loaded. Second attempt ignored.
polluting my logs, so I used:
if(!isset($CI->session)):
$CI->load->library('session');
endif;
hth..
Found this on Codeigniter
forum:
"If you look in the Loader
library, in the function
_ci_load_class, you’ll see that it checks if that class has already
been loaded, and will only load it
again if its being assigned to a new
variable.
Interestingly enough, if you load
the same class multiple times, the
memory usage does go up though"
So if you call $this->load->library(LIB_NAME) more than once, it will only actually load it once. This is from 2009 and CI has been
updated many times since then so not
sure if it's still true.
I hope your db never goes down. But
if it does $CI->db->conn_id
returns true if it can connect.

Redirect (?) issue in CakePHP 1.3: "Failed to load source"

From the /posts/edit-view I'm submitting a form to the action addCategory in my Post controller.
The action does all the work it has to do, and subsequently calls $this->redirect($this->referer());.
At first sight my app works fine, but I encountered some hickups when moving to a production server. Monitoring the calls in Firebug I see that the action acually returns a 302 Found but the 'Response' is Failed to load source for: http://localhost/xps/posts/addCategory.
This happens on both dev en production servers, only on the production server it makes the redirect flow fail. On both servers the controller actions are executed well: category is added.
Removing all the code in the action results in the same failure. Removing the redirect removes the failure, but that's not getting me anywhere.
A second (though maybe irrelevant) irregularity is that the submit method of the form is identified as PUT in Firebug although I explicitly set it to POST in Cake.
I recently switched from CakePHP 1.3.4 to 1.3.6, but reversing does not change the behavior
I use the RequestHandler, Session and Auth components and call parent::beforeFilter() in beforeFilter().
I also found the following thread http://cakephp.1045679.n5.nabble.com/puzzle-over-activity-td1260972.html It suggests to remove $this->Auth->authorize = 'controller'; but I don't have that stated anywhere anyway.
Does anyone have an idea where to look next?
Just a guess, but if you are using Security component, it might cause problems. Also, sometimes when using the ajax and sessions it can cause problems. Maybe if the page requires sessions, you could try it without sessions and see if it works.
Ok, I found it.
The Failed to load source is still there but is not the cause of failure.
In one of my Behaviors I had a space after ?> which messed up the headers, which made me look into the wrong detail.

Resources