Skip to content

Commit

Permalink
running a Sitelet from static property does not fail silently
Browse files Browse the repository at this point in the history
  • Loading branch information
Jand42 committed Oct 26, 2015
1 parent 3104573 commit 6c66bdd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/sitelets/WebSharper.Sitelets/HttpModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ module internal SiteLoading =
| _ -> Seq.empty
)
|> Seq.tryPick (fun ty ->
try
ty.GetProperties(BF.Static ||| BF.Public ||| BF.NonPublic)
|> Array.tryPick (fun p ->
match Attribute.GetCustomAttribute(p, aT) with
| :? WebsiteAttribute ->
ty.GetProperties(BF.Static ||| BF.Public ||| BF.NonPublic)
|> Array.tryPick (fun p ->
match Attribute.GetCustomAttribute(p, aT) with
| :? WebsiteAttribute ->
try
let sitelet = p.GetGetMethod().Invoke(null, [||])
let upcastSitelet =
sitelet.GetType()
Expand All @@ -69,10 +69,10 @@ module internal SiteLoading =
.Invoke(sitelet, [||])
:?> Sitelet<obj>
Some (upcastSitelet, [])
| _ -> None
)
with _ -> None

with e ->
raise <| exn("Failed to initialize sitelet definition: " + ty.FullName + "." + p.Name, e)
| _ -> None
)
)

let TryLoadSite (assembly: Assembly) =
Expand Down

0 comments on commit 6c66bdd

Please sign in to comment.