Skip to content

Commit 59a859b

Browse files
committed
fix http response objects
1 parent 7ea10d8 commit 59a859b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecAppInsightsQuery.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,22 @@ function Invoke-ExecAppInsightsQuery {
2727
return [HttpResponseContext]@{
2828
StatusCode = [HttpStatusCode]::OK
2929
Body = @{
30-
Results = @($LogData)
31-
}
32-
Metadata = @{
33-
Query = $Query
30+
Results = @($LogData)
31+
Metadata = @{
32+
Query = $Query
33+
}
3434
}
3535
}
3636

3737
} catch {
3838
return [HttpResponseContext]@{
3939
StatusCode = [HttpStatusCode]::InternalServerError
4040
Body = @{
41-
Error = "Failed to execute Application Insights query: $($_.Exception.Message)"
41+
Results = "Failed to execute Application Insights query: $($_.Exception.Message)"
42+
Metadata = @{
43+
Query = $Query
44+
Exception = Get-CippException -Exception $_
45+
}
4246
}
4347
}
4448
}

0 commit comments

Comments
 (0)