-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking changes between Giraffe 0.1.0-alpha-025 and 0.1.0-beta001 #80
Comments
This should be done because Giraffe has break changes on the new beta001 version. Which can be explained here: giraffe-fsharp/Giraffe#80
The error handler needs to be updated to use new HttpHandler format such that it additionally accepts a 'HttpFunc' functions as well as 'HttpContext' like 'fun next ctx ->. ..' In the last line where handlers are composed, instead of 'ctx |> (handler)' you need to apply both parameters to functions like '(handler) next ctx' |
Yes, I understand. Your tip fixed the problem. I can know why this change was made? Is related to the new If anyone struggle with it too, the new errorHandler which works is it: // ---------------------------------
// Error handler
// ---------------------------------
let errorHandler (ex : Exception) (logger : ILogger) (next: HttpFunc) (ctx : HttpContext) =
logger.LogError(EventId(0), ex, "An unhandled exception has occurred while executing the request.")
(clearResponse >=> setStatusCode 500 >=> text ex.Message) next ctx |
Both this continuation update and task were done for performance reasons, you can read blog post I did to explain performance benefits here if your interested. It's a slightly more complex way of doing the handlers but there is a focus on performance and the consensus was it was worth breaking now for the long run. If you have anymore issues let me know, happy to help. |
Apologies for this issue. Even though I have updated the latest giraffe-template, the previous versions break now when you pull the beta package from an alpha template. I should have not referenced giraffe with a wildcard in the .fsproj. I will set it to a specific version going forward with the new template releases, but meanwhile if someone runs into this issue you can either pin the latest giraffe alpha package, or preferably update the error handler to match the new beta. You can simplify the error handler even further: let errorHandler (ex : Exception) (logger : ILogger) =
logger.LogError(EventId(), ex, "An unhandled exception has occurred while executing the request.")
clearResponse >=> setStatusCode 500 >=> text ex.Message Also please update the giraffe-template by running:
|
…sion 0.1.8 will always continue to work. Fixes #80 for the future.
I don't know if this was intended, but based on the template of few days ago when I try compile my project with the new version, I got:
Running through 0.1.0-alpha-025 I got compiling fine, I just want know what is design changes on the new beta.
Where the source is basically the template default:
The text was updated successfully, but these errors were encountered: