Merge: core: fix rmdir not reporting some errors
authorJean Privat <jean@pryen.org>
Mon, 19 Sep 2016 19:03:36 +0000 (15:03 -0400)
committerJean Privat <jean@pryen.org>
Mon, 19 Sep 2016 19:03:36 +0000 (15:03 -0400)
commit99204cc442f91b814798793c576c4fc2cd4308cf
tree5a6ce66847c62c5f2d2347cca38fbf73089348e2
parent917abdfa8bf4fa225932865ad62b5a092c679011
parent5d616b3c2f5f326a0b16a811aaea7f3d6260ba0e
Merge: core: fix rmdir not reporting some errors

Fix `rmdir` to raise an error on failure to remove a folder, instead of on success. Also fix error management in recursive calls where some errors could be lost.

The name of the attribute `Path::last_error` is misleading with `rmdir` as it stores the first error of the last call, and it is set to `null` if there is no error (overwriting the true last error), so it very rarely contains the actual last error. Note that, `Path::last_error` has a different logic than `Stream::last_error` which does keep the last error and does not reset it. In the future, I would suggest to rename `Path::last_error` to `error` to avoid confusion or to use an array that is cleared at the beginning of each method (as it is currently done with `Path::last_error`).

Pull-Request: #2309
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>