4

以下代码给出错误,我不知道是什么原因,以及如何消除此错误,告诉我我做错了什么。

def members(id:String,name:String) = Action { implicit request =>
    try{
        session.get("userId").map{user=>
            val Data =NewModel.getInfo(id)
            val userId=session.get("userId").get
            if(userId==Data.createdBy){
                Ok(html.groupMembers(Data,"mainAdmin"))
            }else{try{
                    val admin=NewModel.admin(id,userId);
                        Ok(html.members(Data,"subAdmin"))
                 }catch{
                        try{
                            val member=NewModel.member(id,userId)
                                Ok(html.members(Data,"member"));
                        }catch{
                          if(Data.privacy!="secret")
                            Ok(html.members(Data,"outsider"))
                          else
                            Ok(html.noPageFound())
                        }
                 }   
            }   
        }.getOrElse{
            Redirect("/")
        }
    }catch{
        case e=>
          println(e)
          Ok(html.onError())
    }
    }//end groupSetting
4

1 回答 1

13

在每个 catch 块中使用它

catch{
    case e=>
      //code
}

编辑:

catch{
    case e:Exception=>
      //code
}
于 2013-11-13T09:49:12.280 回答