Commit 156a9a2
Include errno in iOS bundle open/stat failure messages (#58383)
Summary:
Pull Request resolved: #58383
When `RCTJavaScriptLoader` fails to open or stat the JS bundle, the resulting
`NSError` carried only the bundle path. The `errno` set by the failing `fopen()` /
`stat()` was discarded, so a bundle that is absent (`ENOENT`) was indistinguishable
from one that exists but cannot be read (`EACCES`, `EIO`). Because
`RCTInstance handleBundleLoadingError:` turns every loader error into a fatal, this
is the only diagnostic information available after the fact — and there was none.
Capture `errno` immediately after the failing call (before any intervening call can
clobber it) and surface it in two ways: appended to the localized description as
`(errno <n>: <strerror>)`, which is what ends up in the crash report, and as an
`NSPOSIXErrorDomain` error under `NSUnderlyingErrorKey` for programmatic consumers.
Purely additive to error paths that already abort; no behavior change on success.
Changelog:
[iOS][Changed] - Include `errno` and its description in `RCTJavaScriptLoader` bundle open/stat errors
Reviewed By: javache
Differential Revision: D118952499
fbshipit-source-id: 6f711dde3969f9fdcd1af300121d954a2da8816e1 parent 9a49fc2 commit 156a9a2
1 file changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
146 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
147 | 157 | | |
148 | 158 | | |
149 | 159 | | |
| |||
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| 203 | + | |
193 | 204 | | |
194 | 205 | | |
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
198 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
199 | 214 | | |
200 | 215 | | |
201 | 216 | | |
| |||
0 commit comments