I am using the following code to send Error message.
This is my own error code and custom message. I am sending the message in response.
throw new WebApplicationException(
Response.status(1002)
.header(ae.getMessage(), ae)
.type(MediaType.TEXT_PLAIN)
.build());
The problem is, the front end guys are able to see the status code but not the message. Is there any other way to solve this issue?
You should use entity method to set message:
Response.status(1002)
.entity(ae.getMessage())
.type(MediaType.TEXT_PLAIN)
.build());
Related
my requirement is to sent the error http status and error message in the body.
In Case of error in flow i need to pass the http code in the status field.
I can configure this http listner but don't know how to set this to get into payload. Please guide on that.
I'm expecting the MEL to get the 400 Bad Request
{
'status': "400 Bad Request",
'message': error.description
}
I could think of 2 ways of doing this:
1.You can use RAML and for every status code you can send appropriate responses as per your use case.This I think is the best way of doing it.
2.You can have the value for status and message key of your response body inside error handling block.Configure the 'TYPE' condition of your error handling block to catch a certain HTTP error message , then inside that you can set 2 vars: one with the status value and other with message value.Then use this vars in the Error response section of HTTP listener. You'll be ending up with many such error handling blocks if you want to address multiple status codes.
Let me know if you need further clarifications.Hope it helps.
I'm following DeserializeErrorBody.java as a guide
When I use Converter<ResponseBody, Error> errorConverter, Error being a POJO class for my errors, I would get an EOFException trying to do errorConverter.convert(response.errorBody()); with the log being:java.io.EOFException: End of input at line 1 column 1 path$...
If I were to log erroBody.string() it would print the error that the server sends {"message":"Incorrect user or password"}
Moreover the error code at response.code() is 401 and the response.body() is null
Why do I get this error if the body is not null?
I was using Observable<ResponseBody> for the Retrofit interface, like I would use Call<ResponseBody> to check only response.isSuccessful().
Turns out I need to use Observable<Response<Void>> to skip the deserialization of an empty body which causes the EOFException.
Is it possible to get and insert the previous connector's error message in a connector that gets triggered on failed after, to log the error message?
I did a seach and tested something like: #{body('XML_Validation')['message']}.
If so, is it also possible to get the Error code for the failed connector?
-----UPDATE-----
Ok so the previous test of #{body('XML_Validation')['message']} works on some connectors but not XML-Validation.
Is it still possible to extract the error message / exception somehow?
this is what i watch to get as a message to implement in another logic app:
Every action following the trigger-event can run under specific conditions. Defined like this in the code view:
"runAfter": {
"PreviousAction": [
"Succeeded"
]
}
You could set the "runAfter" to run on "Failed" and capture the message this way.
Have a look at: https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-exception-handling
Building on Steven's comment from the accepted answer, in my case I used the following:
#actions('Add_registrant_to_GoToWebinar')['outputs']['statusCode']
It allows to get the statusCode from the raw output of the connector, because this connector does not expose it.
I have a question regarding to Nest1.0pr and the connection error handling. In the previous versions of Nest I was using IResponse.ConnectionStatus.Error. It seems to me that the property Error does not exist in the new version anymore. However in the documentation I found the following:
ConnectionStatus is the response as it was returned by
Elasticsearch.net. It's section on handling responses applies here as
well.
And in the very section the property Error is mentioned.
Error When a call succeeds but does not return a http status code of
200 this property will have details on the error. Read more about
error handling here
So is the recommended way to check whether the property Success is false?
TIA
This changed when NEST was refactored to use Elasticsearch.Net. Now when a request fails, you can try checking the IResponse.ConnectionStatus.OriginalException property, which will contain the actual Elasticsearch error.
When I Uncomment this line for api documentation
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/BitCoinWrapperAPI.xml")));
I received an error :
An exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll but was not handled in user code
Additional information: Activation error occured while trying to get instance of type HelpController, key ""
When I call the Index page in the HelpController of the API, anybody knows why?
Well I added this line and it works without exception
ObjectFactory.Configure(x => x.SelectConstructor(() => new HelpController()));