- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
当处理程序中遇到异常时,如何使 Django 信号处理程序不会静默失败?
在使用开发服务器时是否有记录所有这些错误的地方?
为什么 django 信号处理程序无论如何都会默默地失败?是不是违反了Zen of Python中的一句话?
Zen of Python clearly states...
Errors should never pass silently.
这使它们成为调试的噩梦。你所看到的只是信号没有被触发......
我找到了 this问题,但答案对我来说没用,因为它对问题非常具体(答案建议使用 pyflakes,我已经使用 pydev 可以进行令人满意的静态分析)
最佳答案
是的,我的想法和你一样:错误永远不应该默默地失败
Django 的内置信号不会静默失败,因为它们使用 send()
send_robust()
会忽略异常来自 send_robust() 的文档
send_robust() catches all errors derived from Python’s Exception class, and ensures all receivers are notified of the signal. If an error occurs, the error instance is returned in the tuple pair for the receiver that raised the error.
由于 django 不使用 send_robust()
,请调查它被调用的位置。我猜它在您的源代码中,或者在第三方应用程序的代码中。
关于python - 当信号处理程序中遇到异常时,如何使 Django 信号处理程序不会静默失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14481225/
我对 JavaScript/jQuery 和 Web 开发有点陌生。我当前的项目是为网站建立一个小型聊天室。一切正常,但我有一个问题: 如何将数据从客户端传输到服务器并返回(例如通过 javascri
warn 4 与 print STDERR 4 有何不同? perl -e 'local *STDERR; warn 4' (输出仍然转到 STDERR ) perl -e 'local *STDER
所以在面对可怕的javax.faces.application.ViewExpiredException之后,我不得不在互联网上寻找合适的解决方案。幸运的是,这些解决方案随时可用,我继续采用了 Omn
我正在尝试使用 Spring Modules 项目中的声明性缓存。 它不起作用,即。似乎没有任何东西被缓存。 这是我的配置:
我正在实现以下教程:Speech To Text 我正在使用 AVAudioEngine 和 SFSpeechRecognizer 录制音频实现语音到文本。此处教程使用以下方法将语音引导至文本一个开始
我有一个文本(有多行),需要将其放入 wxPython TextCtrl 中。 问题是其中一些行包含无法打印的字符。 我的解决方案是使用 AppendText,并 try catch 有问题的行。 当
有没有办法直接从 Angular/客户端应用程序使用“用户名”和“密码”登录? 例如像这样的东西? Keycloak.init({username: 'guest', password: 'abc'}
我这样执行 GET 请求: http://www.smurf.com/path/?var=val 这显示在用户的 URL 中。我当然在几乎每个主要网站上都看到了这一点。 但我只是好奇是否有办法绕过它。
假设我有两个相互硬链接(hard link)的文件: -rw-rw-r-- 2 mparrott grp 5 Jul 28 09:38 bar -rw-rw-r-- 2 mparrott grp 5
我想在 android 4+ 中以编程方式(直接)添加日历事件。这可以在模拟器上测试吗?我没有安卓手机。一些示例代码将不胜感激。我阅读了 android 开发人员的日历提供程序,但我很困惑。如何将事件
我正在向我的工作簿添加一个新工作表 Application.ScreenUpdating = False SheetExists = False For Each WS In Worksheets
我正在 Excel 中的 VBA 中进行一些网页解析;我是 MSHTML 来下载和解析网页。但是,在某些站点上,会弹出一个对话框。它工作正常;但是,我想知道是否有办法禁用它或可能绕过它。感谢您的时间。
有没有办法使用谷歌的 firebase 发送一个无声的 APNS? 似乎如果应用程序在后台,它总是会向用户显示通知。 谢谢? 最佳答案 您可以使用 FCM 服务器 API 发送静默 APNS 消息 h
我有一个 Powershell 脚本来放松机器上的执行策略,本质上是运行: Set-ExecutionPolicy Unrestricted -Force 由于 ExecutionPolicy 在机器
我有一个 Powershell 脚本,用于将我们的生产数据库复制到我们的测试环境以及相关的清理事件。我想清理为用户输出到控制台的信息,但在清理从 Az.sql 命令中收到的错误消息时遇到了问题。 我的
这是我当前的 Facebook 应用程序登录流程(有关解释,请参阅 this answer)。 logout() 和 login() 是在用户注销或登录时呈现页面的虚拟函数。 window.fbAsy
我有一个 React Native 应用程序,我正在尝试将静默的 iOS 推送通知发送到 JavaScript 中的处理程序。 我看到的行为是 AppDelegate 中的 didReceiveRem
我正在使用数据通知来更新我的应用程序状态,它在 Android 上运行完美,但我无法在 IOS 上接收到任何数据消息,甚至没有触发 onMessage 监听器。 我正在使用这些: firebase_c
我知道较新的 GCC 版本引入了可能错误的字符串操作“stringop-truncation”的警告 这是我可以轻松触发此警告的示例代码: $ cat strncpy-warning.cxx #inc
标题基本上描述了它。 我检查过的事情: 验证了远程 Powershell session 中的用户名(以确保事情正在以我期望的权限执行) 检查了所描述文件的权限。预期用户拥有文件的完全控制权 删除了
我是一名优秀的程序员,十分优秀!