Custom error message

Seems using the OnModuleException in combination with re-raising gives Sparkle the opportunity to prcocess the Response. Not sure if this is the best/only way to go, but then we can manually set the response body

  FXDataServerModule.Events.OnModuleException.Subscribe(
    procedure(Args: TModuleExceptionArgs)
    begin
      if Args.Exception is EXDataHTTPException then
      begin
        Args.Action := TModuleExceptionAction.RaiseException;
      end;
    end
  ); 

from sparkle:

Try
Next(Context);
Except
on E: EXDataHTTPException do
begin
Context.Response.StatusCode := 422;
Context.Response.Close(TEncoding.UTF8.GetBytes(E.ErrorCode));
end;
End