red / REP

Red Enhancement Process
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

`DELETE` should throw an error in case that it fails #99

Open Oldes opened 3 years ago

Oldes commented 3 years ago

Although I consider as a nice change, that delete %not-existing-file now returns false instead throwing an error, I still believe, that it should throw an error, if the file exists and cannot be deleted (rights, locked..).

https://gitter.im/red/bugs?at=603278b347585464db91e088

Currently:

>> delete %aaaa
== false
>> delete %/
== false

Expected:

>> delete %aaaa
== false
>> delete %/bin/sh
** Access error: cannot delete: %/bin/sh

The error could also contain a reason, but I'm not sure if it's necessary.

hiiamboris commented 3 years ago

It would indeed be great if error shown a message from the OS. In the console we usually know what's happening but in a GUI program it's simply not nice to show dumb "no can't do" errors. With extra info, programmer will be able to deliver this info to the user.

It's a bigger design question though, what I/O operations should provide more verbosity in errors.

Oldes commented 3 years ago

Possible scenario where the change would be useful: