Interfaces/GraphQL: Improve debugging

This commit is contained in:
Jonathan Jenne
2021-09-30 13:15:23 +02:00
parent 65447df0ca
commit d73e3e2f28
4 changed files with 57 additions and 21 deletions

View File

@@ -118,6 +118,30 @@ Public Class GraphQLInterface
End Try
End Function
Public Function ReadJSONPathFragmented(pObject As Linq.JObject, pJsonPath As String)
Dim oSplitPath As List(Of String) = pJsonPath.Split(".").ToList()
Dim oCurrentPath As String = String.Empty
For Each oPart In oSplitPath
If oCurrentPath = String.Empty Then
oCurrentPath = oPart
Else
oCurrentPath &= "." & oPart
End If
_logger.Debug("Selecting Path Fragment [{0}]", oCurrentPath)
Try
pObject.SelectToken(oCurrentPath, errorWhenNoMatch:=True)
Catch ex As Exception
_logger.Warn("Path Fragment [{0}] did not return a valid token", oCurrentPath)
Return False
End Try
Next
Return True
End Function
Private Function GetRequest(Url As String, PostData As Byte()) As HttpWebRequest
Try
Dim oRequest As HttpWebRequest = WebRequest.Create($"{_baseUrl}{Url}")