Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message when writing an Excel file to a nonexistent directory #11516

Open
radeusgd opened this issue Nov 8, 2024 · 0 comments
Labels
--bug Type: bug -libs Libraries: New libraries to be implemented l-writedata

Comments

@radeusgd
Copy link
Member

radeusgd commented Nov 8, 2024

The following test should pass:

diff --git a/test/Table_Tests/src/IO/Excel_Spec.enso b/test/Table_Tests/src/IO/Excel_Spec.enso
--- a/test/Table_Tests/src/IO/Excel_Spec.enso	(revision 28c59ca66474346052d4bdf4283382feb04cb3cb)
+++ b/test/Table_Tests/src/IO/Excel_Spec.enso	(date 1731067786353)
@@ -644,9 +644,11 @@
             f = parent / ("foo."+suffix)
             t1 = Table.new [["X", [1, 2, 3]]]
             r1 = t1.write f (..Sheet "Another")
-            Test.with_clue "("+r1.catch.to_display_text+") " <|
+            Test.with_clue "(r1 = "+r1.catch.to_display_text+") " <|
                 r1.should_fail_with File_Error
                 r1.catch.should_be_a File_Error.Not_Found
+                # We want the Not found error to point to the nonexistent directory, not some file that is just being written.
+                r1.catch.file.path . should_equal parent.path
 
         group_builder.specify "should allow to write and read-back Unicode characters" <|
             encodings = enso_project.data / "transient" / ("encodings."+suffix)

Currently it fails with:

    - [FAILED] should fail if the parent directory does not exist [7ms]
        Reason: (The file at X:\NBO\enso\test\Table_Tests\data\transient\nonexistent\foo.xls.temp.262091447510400 does not exist.) 'X:\\NBO\\enso\\test\\Table_Tests\\data\\transient\\nonexistent\\foo.xls.temp.262091447510400' did not equal 'X:\\NBO\\enso\\test\\Table_Tests\\data\\transient\\nonexistent' (at X:\NBO\enso\test\Table_Tests\src\IO\Excel_Spec.enso:651:17-61).

The problem is that the Not_Found error is associated with a path to a temporary file created next to the destination. It is misleading. It says that some random temp file does not exist. Which is confusing for the user because why some random file not existing be a problem??

The true error is the parent directory not existing and the reported error should reflect that.


Bonus points: ideally, if we create an XLS under foo/nonexistent_directory/child_dir/f.xls, it should also correctly report the directory and the file. Here it seems ok to return either Not_Found foo/nonexistent_directory/ or Not_Found foo/nonexistent_directory/child_dir, as both directories do not exist.

@radeusgd radeusgd added --bug Type: bug -libs Libraries: New libraries to be implemented l-writedata labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -libs Libraries: New libraries to be implemented l-writedata
Projects
Status: New
Development

No branches or pull requests

1 participant