ahyatt/emacs-websocket — pull request #9 by tkf (2012-05-13 18:53:59+00:00)
Title: Ignore errors occurred in the user specified filter

There is a problem when the filter function raises an error. As websocket-outer-filter holds current "parser state" in local variables (start-point, end-point and text), the state is lost when the filter function raises an error. This pull request solves this problem.

Change summary:

1. 281c68476aa3382b8ed964c1839c1b51184ea6db: It's just a cosmetic change.
2. db942589fa0b8c864355f8667858d954bd878037: You should see that the newly added test fails.
3. 1dbf7cec84b5b36cbf7d6477bb87301dd6667722: The new test passes now. Solution is to simply wrap user filter by ignore-errors.

Maybe ignore error is not good solution here? I think alternatives are:

1. Add "on-error" callback and call it when the error occurs.
2. Stop the while loop in websocket-outer-filter when error is raised, store the current state (is setting inflight-packet enough?) and re-raise the error.

What do you think? Is the current ignore-errors solution OK? Do you have any suggestions?