Update src/router.ps1
This commit is contained in:
@@ -95,7 +95,9 @@ function Dispatch-Request {
|
|||||||
# Always return something so clients don't hang
|
# Always return something so clients don't hang
|
||||||
try {
|
try {
|
||||||
$Context.Response.StatusCode = 500
|
$Context.Response.StatusCode = 500
|
||||||
$msg = "Dispatch error: $($_.Exception.Message)"
|
$pos = if ($_.InvocationInfo) { $_.InvocationInfo.PositionMessage } else { "" }
|
||||||
|
$stk = if ($_.ScriptStackTrace) { $_.ScriptStackTrace } else { "" }
|
||||||
|
$msg = "Dispatch error: $($_.Exception.Message)`n$pos`n$stk"
|
||||||
$bytes = [Text.Encoding]::UTF8.GetBytes($msg)
|
$bytes = [Text.Encoding]::UTF8.GetBytes($msg)
|
||||||
$Context.Response.ContentType = 'text/plain; charset=utf-8'
|
$Context.Response.ContentType = 'text/plain; charset=utf-8'
|
||||||
$Context.Response.ContentLength64 = $bytes.Length
|
$Context.Response.ContentLength64 = $bytes.Length
|
||||||
|
|||||||
Reference in New Issue
Block a user