HHVM+黑客语言 : errors/warnings output into browser

标签 hhvm hacklang

有没有办法告诉 HHVM 将 Hacklang 警告和错误输出到浏览器中?像 PHP 那样启用 display_errors , display_startup_errorserror_reporting设置为 E_ALL
HHVM 版本:

$ php -v

HipHop VM 3.1.0-dev+2014.04.09 (rel)
Compiler: heads/master-0-g4fc811c64c23a3686f66a2bea80ba47f3eaf9f3d
Repo schema: 79197c935790c0b9c9cb13566c3e727ace368117

我尝试了以下配置:
$ cat /etc/hhvm/php.ini
; php options
display_startup_errors = On
error_reporting = E_ALL
display_errors = On

; hhvm specific 
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false

和 :
$ cat /etc/hhvm/server.ini 

; php options
pid = /var/run/hhvm/pid

; hhvm specific 
hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.mysql.typed_results = false
hhvm.debug.full_backtrace = true
hhvm.debug.server_stack_trace = true
hhvm.debug.server_error_message = true
hhvm.debug.translate_source = true

最佳答案

tl;博士:你不能。

这里要记住的是,类型检查器会对您的代码进行静态分析,而您谈论的 PHP 错误则在运行时出现。如果这是 C++,您可以将 Hack 类型检查器错误与编译步骤中的错误进行比较 - 因此 Hack 会在代码运行之前告诉您错误的事情。

诀窍是使用 vim or emacs在您保存文件时警告您错误的插件,或使用 hh_client从终端,或者为你最喜欢的 IDE 构建一个插件(随意发送拉取请求!)。 hh_client --json如果你想为 Sublime Text、Eclipse 或任何你想要的插件构建一个插件,它会提供一个易于解析的输出。

请注意,有些错误是运行时错误,有些则不是。例如,对于最新的 HHVM 构建,函数参数和返回类型应该在运行时抛出异常。问题在于,当您遇到某个代码路径时,您只会看到这些错误。 Hack 的美妙之处在于它会为您代码中的所有问题出错,即使它是您可能不会在运行时测试的代码路径。

关于HHVM+黑客语言 : errors/warnings output into browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22995847/

相关文章:

travis-ci - 为 HHVM 覆盖 php 的属性

php - 在 HHVM + Apache + fastCGI 上部署 Symfony2

php - 如何在 hacklang/hhvm 中使用 Mysql PDO 驱动程序

ide - 用于黑客语言的 PHPStorm

php - HHVM/FastCGI/Proxy 安装毁了我的 apache?

php - Hack - 如何检查实例是否使用了 Trait?

ubuntu - HHVM 已安装,但根据 error.log,环境中缺少类型检查器

php - 你会如何从 PHP 迁移到 Hack?

php - Hack/HHVM 与 PHP/HHVM 之间的性能差异