Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging errors from forked processes #55

Merged
merged 1 commit into from
Nov 29, 2013
Merged

Conversation

mctep
Copy link
Contributor

@mctep mctep commented Nov 18, 2013

Логируем ошибки от подпроцессов.
Такие ошибки бывают в том случае, если ручка не вернет никаких данных, а дескрипт попытается на них вызывать блок. Например:

de.http('http://mysuperdomain.com', { // тут предположим вернется пустой объект
    result: function(result) {
        // а тут кинется ошибка мол data is undefined
        // и эта ошибка в логах никак не зафиксируется
        // и мы не сможем понять что происходит
        return result.data.super.property.bar;
    }
})

@chestozo
Copy link
Contributor

/cc @pasaran Серёжа, чего думаешь про этот PR?

@chestozo
Copy link
Contributor

Синтаксические ошибки в jsx файле тоже игнорируются сейчас.

pasaran added a commit that referenced this pull request Nov 29, 2013
Logging errors from forked processes
@pasaran pasaran merged commit 17c6f19 into pasaran:master Nov 29, 2013
@pasaran
Copy link
Owner

pasaran commented Nov 29, 2013

Смержил.

@chestozo
Copy link
Contributor

Выложи в npm, пожалуйста.

@pasaran
Copy link
Owner

pasaran commented Dec 21, 2013

0.0.44

@chestozo
Copy link
Contributor

Есть, правда, пара моментов:

  • на один exception может быть несколько строк и каждая строка идёт отдельной записью
  • переносы строк показываются
  • не выводится pid процесса, где произошла ошибка
[21.12.2013 23:35:31.519] [info] [26180.0] [http "http://host.net:32090/..."] ended (4ms)
[21.12.2013 23:35:31.520] [error]

[21.12.2013 23:35:31.521] [error] evalmachine.<anonymous>:32

[21.12.2013 23:35:31.521] [error]             var prefs = result.object().result.preferences.preference;

[21.12.2013 23:35:31.530] [error]                                        ^
TypeError: Cannot read property 'preferences' of undefined
    at Object.getUserPreferences.de.call.after (evalmachine.<anonymous>:32:47)
    ...
[21.12.2013 23:35:31.531] [error] process died. pid = 26180

@chestozo
Copy link
Contributor

Как вариант, можно было бы вместо того, чтобы слушать forked.process.stderr обернуть evaled в try/catch и ловить exception там (https://github.com/pasaran/descript/blob/master/lib/de.file.js#L115-L117).
@pasaran, что думаешь?

@pasaran
Copy link
Owner

pasaran commented Dec 21, 2013

Оно же и так в try/catch вроде

Sergey Nikitin

On Saturday 21 December 2013 at 23:45, chestozo wrote:

Как вариант, можно было бы вместо того, чтобы слушать forked.process.stderr обернуть evaled в try/catch и ловить exception там (https://github.com/pasaran/descript/blob/master/lib/de.file.js#L115-L117).
@pasaran (https://github.com/pasaran), что думаешь?


Reply to this email directly or view it on GitHub (#55 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants