Skip to content

Commit

Permalink
fix #902 InferWithCustomErrors throwing null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Jand42 committed Feb 7, 2018
1 parent 9680e95 commit 409d451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/sitelets/WebSharper.Sitelets/RouterInfer.Client.fs
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,8 @@ module InferRouter =
/// Creates a router based on type shape and WebSharper attributes,
/// that catches wrong method, query and request body errors.
let InferWithCustomErrors<'T when 'T: equality>() =
let t = typeof<'T>
S.getRouter t
|> ServerInferredOperators.IWithCustomErrors t
S.getRouter typeof<'T>
|> ServerInferredOperators.IWithCustomErrors typeof<ParseRequestResult<'T>>
|> ServerInferredOperators.Unbox<ParseRequestResult<'T>>

/// Optimized version of Infer to use straight in a Sitelet
Expand All @@ -472,7 +471,6 @@ module InferRouter =

/// Optimized version of InferWithCustomErrors to use straight in a Sitelet
let internal IInferWithCustomErrors<'T when 'T: equality>() =
let t = typeof<'T>
S.getRouter t
|> ServerInferredOperators.IWithCustomErrors t
|> ServerInferredOperators.Unbox<ParseRequestResult<'T>>
S.getRouter typeof<'T>
|> ServerInferredOperators.IWithCustomErrors typeof<ParseRequestResult<'T>>
|> ServerInferredOperators.IUnbox<ParseRequestResult<'T>>
1 change: 0 additions & 1 deletion src/sitelets/WebSharper.Sitelets/Sitelet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ module Sitelet =
}
}

[<Obsolete>]
let InferWithCustomErrors<'T when 'T : equality> (handle : Context<'T> -> ParseRequestResult<'T> -> Async<Content<'T>>) =
{
Router = Router.IInferWithCustomErrors<'T>()
Expand Down

0 comments on commit 409d451

Please sign in to comment.