# 在哪里检查插件的异常

**URL:** <https://meta.discourse.org/t/where-to-check-exception-of-plugin/126095>\
**Category:** Development\
**Created:** [2019年八月18日 05:32 UTC](https://meta.discourse.org/t/where-to-check-exception-of-plugin/126095 "2019-08-18T05:32:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![livc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/livc/32/140055_2.png) [@livc](https://meta.discourse.org/u/livc)\
**Post date:** [2019年八月18日 05:32 UTC](https://meta.discourse.org/t/where-to-check-exception-of-plugin/126095/1 "2019-08-18T05:32:51Z")

</div>

你好，

我使用了一个包含以下代码的插件：

```ruby
          rescue Exception => e
            feed.exceptions << e.message << '&#10;'
          end

```

我想了解在哪里可以查看这些异常？是日志文件还是其他地方？该如何查看？谢谢。（我的 Discourse 是通过 Docker 安装的）

我在 /logs 目录下没有找到任何相关内容。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2019年八月21日 04:25 UTC](https://meta.discourse.org/t/where-to-check-exception-of-plugin/126095/2 "2019-08-21T04:25:10Z")

</div>

如果您想将异常记录到日志中，请尝试：

```plaintext
Rails.logger.warn "在此处输入您的文本"

```

如果您想报告异常，请使用：

```plaintext
Discourse.warn_exception(e, message: "出错了")

```

`warn_exception` 更加智能，因为它会为消息保留正确的回溯信息。

---

<div class="post-metadata">

**Author:** ![livc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/livc/32/140055_2.png) [@livc](https://meta.discourse.org/u/livc)\
**Post date:** [2019年八月22日 13:02 UTC](https://meta.discourse.org/t/where-to-check-exception-of-plugin/126095/3 "2019-08-22T13:02:13Z")

</div>

谢谢！！！我会检查一下。
