Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't catch all errors in Watchman.watch_project
Summary: `Watchman.watch_project` calls `watchman watch-project /path/to/root/some/include` where `some/include` is in the flowconfig `[includes]`. if that path doesn't exist, `watchman watch-project` returns a response like `{"error": "std::system_error: open: ... No such file or directory", ...}`. the `"error"` key makes `request_exn` raise a `Watchman_error`, which we suppress and return `None`. we expect this to happen and recover from it. but if the connection is unexpectedly closed, `request_exn` also raises a `Watchman_error` from the socket error, which we couldn't distinguish before. we were treating it like the directory didn't exist and continuing to try to talk to watchman, which blows up because the connection is closed. now, we can use the `result` to only catch error *responses*, and throw immediately when the connection is bad. in the future, we'll thread the result through even further so that we can retry broken connections. Reviewed By: nmote Differential Revision: D28204314 fbshipit-source-id: 4d50cc7f13485ac801cf8e1a01738c4f8f669962
- Loading branch information