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
Disallow table with null .DataRange when saving #926
Disallow table with null .DataRange when saving #926
Conversation
306558e
to
f90e52e
Compare
|
||
namespace ClosedXML.Excel.Exceptions | ||
{ | ||
public class EmptyTableException : Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about inheriting all ClosedXML exceptions from a single one (e.g. abstract ClosedXmlException
)? This would make them easier to catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely.
ab5f76f
to
be7317a
Compare
public abstract class ClosedXMLException : Exception | ||
{ | ||
protected ClosedXMLException() | ||
: base() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improper indentation
ClosedXML/Excel/Tables/XLTable.cs
Outdated
|
||
public IXLRange AppendData(IEnumerable data, bool transpose) | ||
{ | ||
if (data == null || data is String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a check for the empty collection, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and a dedicated test too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will address in #908
ClosedXML/Excel/Tables/XLTable.cs
Outdated
|
||
public IXLRange ReplaceData(IEnumerable data, bool transpose) | ||
{ | ||
if (data == null || data is String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - check if the collection is empty and add a test for it.
be7317a
to
d2b72b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this will be rebased after #908 is merged.
Yes, will rebase this. Whenever I say "depends on", that is my intention. |
d2b72b6
to
550b6af
Compare
Depends on
#908Throws exception when trying to save a file with a table with no datarange.