User bio
404 bio not found
Member since May 5, 2017
Replies:

When an error has occurred, the return value is not 0. Instead, it is a %Status, and likely already contains the error information you need.

As to your actual question, finding (the id of) the response message header is not trivial. Ensemble Business Services have a %RequestHeader property from which you can take the CorrespondingMessageId, but unfortunately it is only populated if the call did not return an error status. It is still possible, though. You can use the id of the request body to find out what you need. It does need some SQL, though:

ClassMethod GetResponseHeaderId(RequestId As %String, Output sc As %Status) As %String
{
  &sql(SELECT CorrespondingMessageId INTO :ResponseHeaderId
         FROM Ens.MessageHeader
        WHERE MessageBodyId = :RequestId)
  If SQLCODE Set sc = $$$ERROR($$$SQLError, SQLCODE, $Get(%msg))
  
  Set sc = $$$OK
  
  Return ResponseHeaderId
}

With this helper method, you can open the response message header object. Assuming the request body is called CallReq:

  Set Id = ..GetResponseHeaderId(CallReq.%Id(), .sc)
  If 'sc Quit sc
  
  Set RspHdr = ##class(Ens.MessageHeader).%OpenId(Id, , .sc)
  If 'sc Quit sc
  
  $$$LOGINFO("Response is an error: "_RspHdr.IsError)

HTH,
Gertjan.

Yes, something like that could work. I personally won't spend time on this, as I refuse to use the browser editors for this reason. I still use Studio for everything. It has it's annoyances, but at least it doesn't destroy my work for no good reason.

(This whole conversation astonishes me. We are talking about ideas and votes, like this is some minor inconvenience to some, instead of a prio 1 bug that InterSystems should fix yesterday.)

I agree with the problem (and the emotional effect it has!), less with the solution. The moment I e.g. take a call, the BPL/DTL may not be in a state fit to save it. Making the server handle this seems overly complicated. My personal preference would be to just have a simple JavaScript method keep the web session alive as long as the browser is open. That would also alleviate the need for these constant "Your session is about to expire" popups in the Ensemble production portal.

Certifications & Credly badges:
Gertjan has no Certifications & Credly badges yet.
Global Masters badges:
Gertjan has no Global Masters badges yet.
Followers:
Gertjan has no followers yet.
Following:
Gertjan has not followed anybody yet.