记录器在打印对象的Grails4中引发异常

1yjd4xko  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(238)

我向用户发送错误取决于异常我在服务类的loaduserbyusername中写入逻辑

def generalUser = AdminUser.findByUser(user) ?: StoreUser.findByUser(user)
        if (generalUser.userStatuses != UserStatuses.ACTIVE) {
            if (generalUser.userStatuses == UserStatuses.PENDING_CONFIRMATION)
                throw new InternalAuthenticationServiceException('string')
            else if (generalUser.userStatuses == UserStatuses.PENDING_STORE_APPROVAL)
                throw new InternalAuthenticationServiceException('For User approval is pending by store admin.')
           }

每当在上述代码if block中执行抛出行时,调试器都会转到abstractauthenticationprocessingfilter.java,然后在logger.error中,控制台中会打印错误

catch (InternalAuthenticationServiceException failed) {
        logger.error(
                "An internal error occurred while trying to authenticate the user.",
                failed);
        unsuccessfulAuthentication(request, response, failed);
        return;
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题