azist / azos

A to Z Sky Operating System / Microservice Chassis Framework
MIT License
213 stars 29 forks source link

Wave JSON body read error: add system code for HTTP 400 so the client can react to sending an invalid body by capturing such body and logging locally for further analysis #834

Open itadapter opened 1 year ago

itadapter commented 1 year ago

Related: #833

WorkContext.DoGetRequestBodyAsJsonDataMapAsync

catch(Exception error)
        {
          throw new HTTPStatusException(WebConsts.STATUS_400,
                                        WebConsts.STATUS_400_DESCRIPTION + " body processing error",//<===== ADD A TAG So we can search for it
                                        error.ToMessageWithType(),
                                        error);
        }
itadapter commented 1 year ago

We will need to add WebCallExtensions.cs.CallAndGetJsonMapAsync(client) to handle new aspect IBadBodyCaptureAspect which will be triggered post request-response with 400 "bad body" using the aforementioned marker code

itadapter commented 1 year ago

Added IHttpBodyErrorAspect