Skip to content

Commit

Permalink
remove argument exception mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed May 11, 2023
1 parent 9b51c85 commit d158414
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/FsSpreadsheet/Cells/FsCellsCollection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,12 @@ type FsCellsCollection() =
/// Returns the upper left corner of the FsCellsCollection.
/// </summary>
member this.GetFirstAddress() =
try
let minRow = _rowsCollection.Keys |> Seq.min
let minCol =
_rowsCollection.Values
|> Seq.minBy (fun d -> Seq.min d.Keys)
|> fun d -> Seq.min d.Keys
FsAddress(minRow, minCol)
with :? System.ArgumentException -> FsAddress(0, 0)
let minRow = _rowsCollection.Keys |> Seq.min
let minCol =
_rowsCollection.Values
|> Seq.minBy (fun d -> Seq.min d.Keys)
|> fun d -> Seq.min d.Keys
FsAddress(minRow, minCol)

/// <summary>
/// Returns the upper left corner of a given FsCellsCollection.
Expand Down
7 changes: 3 additions & 4 deletions src/FsSpreadsheet/FsWorksheet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,9 @@ type FsWorksheet (name, fsRows, fsTables, fsCellsCollection) =
/// Returns the highest index of any FsRow.
/// </summary>
member self.GetMaxRowIndex() =
try
self.Rows
|> List.maxBy (fun r -> r.Index)
with :? System.ArgumentException -> failwith "The FsWorksheet has no FsRows."
if self.Rows.IsEmpty then failwith "The FsWorksheet has no FsRows."
self.Rows
|> List.maxBy (fun r -> r.Index)

/// <summary>
/// Returns the highest index of any FsRow in a given FsWorksheet.
Expand Down

0 comments on commit d158414

Please sign in to comment.