Express js not returning full error on status code 500 but does with code 200 - node.js

I have an express js project that has a try catch, when i respond with status code 500 i get no error detail returned.
Below you can see that when i return status code 200 i get a full response with the error and in this case 'Invalid time value'.
But when i change to status code 500 i get hardly any information, how do i send status code 500 but still get full error information?

this output is normal based on Hypertext Transfer Protocol, you can check the details about status codes here.
when status code is 200
The request has succeeded. The information returned with the response
is dependent on the method used in the request, for example:
GET an entity corresponding to the requested resource is sent in
the response;
HEAD the entity-header fields corresponding to the requested
resource are sent in the response without any message-body;
POST an entity describing or containing the result of the action;
TRACE an entity containing the request message as received by the
end server.
when status code is 500
500 Internal Server Error
The server encountered an unexpected condition which prevented it
from fulfilling the request
this outputs is Hypertext Transfer Protocol and its normal

Related

How to correlate or handle SAML request in LoadRunner

After recording script, and replaying the script, I have found below error:
"FirstRun.c(1035): Error -26630: HTTP Status-Code=401 (Unauthorized) for "">fs.abcdefg.co.uk:443/.../wia [MsgId: MERR-26630]"
I have found one method in my script:
The line 1035 has the following method:
Web_Submit_Form("ls","Snapshot=t12.inf",ITEMDATA,LAST);
The above method is generating SAML Request and in the Response body a 'request ID' is generated.
How to handle it in correlationThe attached image contains my query
I have no idea on how to handle such scenario!

How to choose HTTP status code for unavailable event

Description:
The user inquires about the availability of the event on a given day.
Question:
Which response code should I send back if new event can not be created on this day? 404? 400? 422?
My choice:
I chose the "404 Not Found" status code:
{
"statusCode": 404,
"error": "Not Found",
"message": "The event can not be created on the selected date."
}
As a response to a POST request I would use the 422 Unprocessable Entity status code along with a description of why the request could not be processed.
If you only want to test if there is already an event at this day, perform a GET request (for example: /event/2019-06-01) to check if it exists.
If it does not exist yet, respond with a 404 not found.
Your question is entirely opinion based. You should try learning about various status codes and their reasons. In your case, you may find status code 410 useful, but again, this is entirely opinion based.

Azure API Manager POST Request/Response Limit 65,535

I have an Application API wrapped in API Manager on Azure cloud service. For whatever reason when I send in a JSON payload of 1000 records or more (which translates to around 200k chars) the request is dropped. No trace, no logging just dropped but if I truncate the payload everything works as expected. If I send the same 1000 record payload into the underlying service (not through API Manager) all works as expected. Is there a request or return size limit when using APIM?
My underlying service was matching inner response codes and applying to overall return code if they were the same. My inner codes were all 404 "item not found". Azure API manager treats a 404 as an error and drops large payloads. This is per their support. On a small return payload it will return a code of 404 and the message but on a large payload it is dropped. Reason I was trying to return 404 is because each record in the return payload contains a status. If the status is mixed return 207 for mixed status but if they are all the same - 200 for found and 404 for not found the overall service was returning the internal status as the overall status. This was bad design. My payload consisted of a search for items that did not exist in the DB and therefore was returning 404 as overall status with messages for each record indicating "Not found". APIM was dropping the return response in favor of a generic 404 url not found response. Switched the internal service to return only 200 or 207 depending on outcome and all is right.
{
"ProcessId": "2",
"Code": 404,
"Message": "Could not resolve token.",
"Token": "#!!!#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"ProcessId": "2",
"Code": 404,
"Message": "Could not resolve token.",
"Token": "#!!!#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
Overall return code was set to 404 and APIM dropped the response. I fixed this by setting overall return code to 200 in this case.

Stripe Webhooks Pending Status Test webhook error: 500

I got Test webhook error: 500 Error in Response? Why?
How to resolve the problem? What is 500 error Status mean?
With code 500 it is Internal Server error. So looks like the issue is on the server side.
Please see the various status codes for your reference, this will help you with debugging web requests.
http://www.w3.org/Protocols/HTTP/HTRESP.html

Sharepoint 2013: unexpected response from server. The status code of response is ‘500’

I have term driven navigation when I try to add new term in "term store management", on the TERM-Driven-page link I am getting below mentioned error.
Unexpected response from server. The status code of response is 500.
The status text of response is
system.servicemodel.serviceactivationexception

Resources