mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
The source editor, when it cannot load a particular file, will simply display a blank file instead. At the bottom, this is because the APIs used to load the files do not have a way to propagate an error up to the call site. Rather, the callback either is never called, or is called with just an empty string. This refactor changes the way the project system loads file contents by replacing the callback model with a Promise-based model. However, in this version, rather than propagating an error (handled via catch), the error is exposed as a property on the object passed via the the load functions. Although it might be preferable to use async throw/catch, because there are ~4-5 layers of redirection through the project system, the added complexity seems to not really justify that work. I'm open to reconsidering this design, though. Attempting to load a file via file:// which does not exist previously produced no error because the DevToolsUIBindings handler would just always resolve with no content and HTTP status 200. I had previously addressed that bug in this changeset, but I've split it out to https://chromium-review.googlesource.com/c/chromium/src/+/1847833 . Sample "after" screenshot: https://imgur.com/a/tlm90sg Bug: 961940 Bug: 941035 Change-Id: If121611090e9c35eeb1de162b59f8a9f72f696d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817677 Reviewed-by: Lorne Mitchell <lomitch@microsoft.com> Reviewed-by: Jeff Fisher <jeffish@microsoft.com> Commit-Queue: Lorne Mitchell <lomitch@microsoft.com> Cr-Original-Commit-Position: refs/heads/master@{#705438} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 61ec2a233d9a7bf4bb4b3e610de6fc233ae0d46e