gpt4 book ai didi

haskell - Yesod:函数 isAuthorized 中的非详尽模式

转载 作者:行者123 更新时间:2023-12-02 18:58:16 24 4
gpt4 key购买 nike

在 Yesod 脚手架项目中,我添加了一条新路线和一个新处理程序。

我的错误如下:

29/Mar/2017:11:25:22 +0200 [Error#yesod-core] Foundation.hs:(137,5)-(144,45): Non-exhaustive patterns in function isAuthorized
@(yesod-core-1.4.32-6HthMZNCl0sEMRz6GJ4QO1:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:693:5)
29/Mar/2017:11:25:22 +0200 [Debug#SQL] SELECT `ident`,`password` FROM `user` WHERE `id`=? ; [PersistInt64 1]

如何解决?

最佳答案

需要修改Foundation.hs文件,添加新的授权路由:

-- Routes not requiring authentication.
isAuthorized (AuthR _) _ = return Authorized
isAuthorized CommentR _ = return Authorized
isAuthorized HomeR _ = return Authorized
isAuthorized FaviconR _ = return Authorized
isAuthorized RobotsR _ = return Authorized
isAuthorized (StaticR _) _ = return Authorized
isAuthorized TestR _ = return Authorized

isAuthorized ProfileR _ = isAuthenticated

关于haskell - Yesod:函数 isAuthorized 中的非详尽模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43090033/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com