[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: DOH Error Handling

  • Thread starter Thread starter Peter Judge
  • Start date Start date
Status
Not open for further replies.
P

Peter Judge

Guest
(sorry, that other one got sent by mistake) >The DOH is passing this to the entity writer and it calls writeError if its a progress.lang.error. I've not had to try to override this before but I've seen some of your other stuff on extending the jsonentitywriter >but to be honest what I've done so far hasn't worked. It takles a couple of steps more than it should, because the JsonEntityWriter's WriteError() method is currently private (not protected). Instead of writing a MyJsonWriter that extend JsonEntityWriter, and overriding the WriteError method, you have to write a MyJsonWriter that uses the JsonEntityWriter, except for errors. Something like this should work, but it's a little clunky class MyJsonWriter inherits MessageWriter: def private property mJsonWriter as JsonEntityWriter. // appropriate constructors left out method protected void WriteError(pError as Progress.Lang.Error): // your implementation here end method . method public void Write (pData as Progress.Lang.Object). if valid-object (pData) and type-of (pData, P.L.Error) then WriteError( cast (pData, P.L.Error)). else do : mJsonWriter: Write (pdata). assign this-object :entity = mJsonWriter:entity. end . end method . end class . Alternatively, if you build a JsonObject or JsonArray in the OperationErrorHandler, you can simply assign it to the response's Entity and things should work fine. The main difference is one of scope, I think. The EntityWriters apply to all webhandlers and to the HTTP client too. The handler will apply only to DOH requests.

Continue reading...
 
Status
Not open for further replies.
Back
Top