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

error-handling-sushi #8

Merged
merged 6 commits into from Mar 4, 2015
Merged

error-handling-sushi #8

merged 6 commits into from Mar 4, 2015

Conversation

azu
Copy link
Owner

@azu azu commented Feb 26, 2015

約束されたエラー

Promiseはcatch忘れるとエラーの握りつぶし(unhandledRejection)が発生しやすい。
FirefoxやChromeの開発者ツールにはunhandledRejectionをログとして流す機能がはいってるが、
それをもっとプログラマブルに捉える実装(仕様?)が最近行われているという話

Promise unhandled rejection tracking global handler hook

これの実装では2種類のイベントが発行されるようになる

  • Event 'unhandledRejection':
  • こちらがよく起きるcatchなどをしてなくてrejectされた時に処理するハンドルが登録されてないと起きるイベント
  • Event 'rejectionHandled':
  • こっちは既にRejectedとなったpromiseオブジェクトにたいしてcatchを追加しようとした時に起きるイベント

ライブラリ作者がカジュアルなプロポーサルを書いて実装が進んでる珍しい方針(仕様としての動きはまだコメントがある程度なのであんまりない)

  • bluebirdに入ったエラーハンドリングについて
  • 活用例?
  • io.jsにも入った話
  • V8のPromise実装
  • 今後の仕様的な流れを見る
  • サンプル - azu/Unhandled-Rejection-Tracking

@azu
Copy link
Owner Author

azu commented Feb 27, 2015

@azu
Copy link
Owner Author

azu commented Feb 27, 2015

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

PromiseEvent
(NewPromiseEvent, UpdatePromiseStatusEvent & UpdatePromiseParentEvent)
Issue 393283007: Introduce more debug events for promises. - Code Review

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

Promise unhandled rejection tracking global handler hook

これの実装では2種類のイベントが発行されるようになる

  • Event 'unhandledRejection':
  • こちらがよく起きるcatchなどをしてなくてrejectされた時に処理するハンドルが登録されてないと起きるイベント
  • Event 'rejectionHandled':
  • こっちは既にRejectedとなったpromiseオブジェクトにたいしてcatchを追加しようとした時に起きるイベント

https://github.com/iojs/io.js/blob/685dbd85d4de411ffaca1e8c925fc8c67a8ce988/test/parallel/test-promises-unhandled-rejections.js#L365-L388

によると unhandledRejection -> unhandledRejectionの順番に呼び出される

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

bluebirdの実装

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

io.jsに入ったので、他への実装も進みそう。

when.jsにも入った Release 3.7.0: Add cross-lib debugging events · cujojs/when

@azu
Copy link
Owner Author

azu commented Feb 28, 2015

なぜ、process.on('rsvp:unhandledrejection') みたいにprefix付きのイベント登録じゃなくて、
process.on('unhandledrejection')なのかという話は以下ででてきてる

please, don't emit this event on process object. It could end up conflicting with native node.js/io.js implementation or other libs. If the purpose is to share emitter between dupes, the event should be namespaced somehow (e.g. process.on('rsvp:possiblyUnhandledRejection'))
-- tildeio/rsvp.js#355 (comment)

@azu
Copy link
Owner Author

azu commented Mar 3, 2015

Promise/A+ でも同じような議論あったのか

@azu
Copy link
Owner Author

azu commented Mar 3, 2015

rejectionHandledのユースケースがよくわからない

@azu
Copy link
Owner Author

azu commented Mar 4, 2015

rejection handledとunhabdle rejectionは基本セットで扱う感じがユースケースっぽい。

基本ログ用のイベントだとおもってるけど、
このイベントから復帰みたいなユースケースは存在するのかな?

@azu azu changed the title [WIP] error-handling-sushi error-handling-sushi Mar 4, 2015
azu added a commit that referenced this pull request Mar 4, 2015
@azu azu merged commit 5bb3f90 into gh-pages Mar 4, 2015
@azu azu deleted the error-handling-sushi branch March 4, 2015 14:03
@azu
Copy link
Owner Author

azu commented Mar 4, 2015

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

1 participant