cathei / BakingSheet

Easy datasheet management for C# and Unity. Supports Excel, Google Sheet, JSON and CSV format.
MIT License
346 stars 34 forks source link

RawSheetImporter's ImportRow should wrap page.GetCell in the try block #33

Closed doug-w closed 1 year ago

doug-w commented 1 year ago

I was implementing my own RawSheetImporter and ran into an issue where only about half of the pages in the sheet were being loaded. It turns out that GetCell() was throwing but because it's wrapped in a Task called from an Async MenuItem, nothing actually caught the exception.

I think the GetCell call in ImportRow should be part of the same try/catch that propertyMap.SetValue() is.

cathei commented 1 year ago

By convention, GetCell should not throw and just return null if cell does not exist / out of bounds. Exception from GetCell cannot be caused by data and if it happens that means it's bug in BakingSheet or importer. Will add comment to make this clear.