[RFC] Exceptions or error codes?
lhmouse opened this issue · 0 comments
lhmouse commented
Prolog: We don't take std::bad_alloc
etc. into account here.
std.filesystem.get_information()
a.k.a.stat()
Suggested solution: Returnnull
on failure. Never throw exceptions.
Rationale: Security consideration.std.filesystem.move_from()
a.k.a.rename()
Suggested solution: Always throw an exception on failure.std.filesystem.remove_recursive()
Suggested solution: Return0
if the path does not exist. Throw an exception otherwise.std.filesystem.directory_list()
Suggested solution: Returnnull
if the path does not exist. Throw an exception otherwise.std.filesystem.directory_create()
a.k.a.mkdir()
Suggested solution: Returnfalse
if a directory already exists. Throw an exception otherwise.std.filesystem.directory_remove()
a.k.a.rmdir()
Suggested solution: Returnfalse
if the path does not exist. Throw an exception otherwise.std.filesystem.file_read()
a.k.a.read()
andpread()
Suggested solution: Returnnull
if the path does not exist. Return an empty string if the end-of-file has been reached. Throw an exception otherwise.std.filesystem.file_stream()
a.k.a.read()
andpread()
Suggested solution: Returnnull
if the path does not exist. Return0
if the end-of-file has been reached. Throw an exception otherwise.std.filesystem.file_write()
a.k.a.write()
andpwrite()
Suggested solution: Always throw an exception on failure.std.filesystem.file_append()
a.k.a.write()
andpwrite()
Suggested solution: Always throw an exception on failure.std.filesystem.copy_from()
Suggested solution: Always throw an exception on failure.std.filesystem.file_remove()
Suggested solution: Returnfalse
if the path does not exist. Throw an exception otherwise.