Commit df5acf7
fs: do not pass Buffer when toString() fails
Even though an Error object is passed to the callback when readFile()
fails due to toString() failing, it is a bit strange to still see
data passed as the second argument. This commit changes that and only
passes the Error object in that case.
PR-URL: nodejs#9670
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 6e62353 commit df5acf7
2 files changed
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
| 400 | + | |
| 401 | + | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
411 | | - | |
412 | 410 | | |
413 | 411 | | |
414 | 412 | | |
| |||
417 | 415 | | |
418 | 416 | | |
419 | 417 | | |
420 | | - | |
421 | 418 | | |
422 | 419 | | |
423 | 420 | | |
424 | | - | |
| 421 | + | |
425 | 422 | | |
426 | | - | |
| 423 | + | |
427 | 424 | | |
428 | 425 | | |
429 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
0 commit comments