Skip to content

Error Handlerをつくる #1

@otf

Description

@otf

type ErrorInfo = {
Message : string
StackTrace : string
ExceptionType : string
}

let trySkipCustomErrors (resp:HttpResponse) =
resp.TrySkipIisCustomErrors <- true
resp

let errorHandler f req =
try
f req >> trySkipCustomErrors
with ex ->
let info = {
Message = ex.Message
StackTrace = ex.StackTrace
ExceptionType = (ex.GetType ()).FullName
}
internalServerError >> jsonResponse (JsonUtil.FromObj info) >> trySkipCustomErrors

こんな具合で

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions