Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Nov 29, 2023
1 parent fdf4f41 commit deed106
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Errors.File_Error.File_Error
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
import Standard.Base.Errors.Illegal_State.Illegal_State
import Standard.Base.Runtime.Managed_Resource.Managed_Resource
Expand Down Expand Up @@ -77,11 +78,12 @@ write_file (file : File) (table : Table) (on_existing_file : Existing_File_Behav
writable_workbook->
ExcelWriter.writeTableToRange writable_workbook java_range existing_data_mode skip_rows table.java_table row_limit java_headers

## We handle the panics _outside_ of the `performWrite` call, to ensure that the Java side notices the exception
(it may ignore a dataflow error being returned) and reverts operations if relevant.
write_strategy.if_not_error <| handle_writer <|
ExcelConnectionPool.INSTANCE.performWrite java_file file_format (make_java_existing_file_behavior on_existing_file) writable_workbook->
write_strategy writable_workbook
File_Error.handle_java_exceptions file <|
## We handle the panics _outside_ of the `performWrite` call, to ensure that the Java side notices the exception
(it may ignore a dataflow error being returned) and reverts operations if relevant.
write_strategy.if_not_error <| handle_writer <|
ExcelConnectionPool.INSTANCE.performWrite java_file file_format (make_java_existing_file_behavior on_existing_file) writable_workbook->
write_strategy writable_workbook

## PRIVATE
Handle and map the Java errors when writing an Excel file
Expand Down
3 changes: 3 additions & 0 deletions test/Table_Tests/src/IO/Excel_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ spec_write suffix test_sheet_name =
result = table.write out on_problems=Report_Error . should_succeed
Problems.expect_only_warning Dry_Run_Operation result
result.exists.should_be_true

result.absolute.normalize.path . should_not_equal out.absolute.normalize.path

written = result.read
written.sheet_count . should_equal 1
written.sheet_names . should_equal ['EnsoSheet']
Expand Down

0 comments on commit deed106

Please sign in to comment.