Skip to content

Commit

Permalink
[opt] 当错误地对Bean类型字段使用多行限定列格式时,抛出更清晰的错误信息而不是空指针异常
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Jan 3, 2025
1 parent f8a5fd6 commit 4c9086f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ public DType Accept(TBean type, RowColumnSheet sheet, TitleRow row)
}
if (row.Elements != null)
{
var s = row.AsMultiRowConcatElements(sep);
return type.Apply(ExcelStreamDataCreator.Ins, s);
throw new Exception($"{type.DefBean.FullName} 不支持多行子字段格式,只有结构列表才支持此格式");
}
throw new Exception();
}
Expand Down
5 changes: 0 additions & 5 deletions src/Luban.DataLoader.Builtin/Excel/TitleRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,4 @@ public ExcelStream AsMultiRowConcatStream(string sep)
{
return new ExcelStream(Rows, SelfTitle.FromIndex, SelfTitle.ToIndex, sep, SelfTitle.Default);
}

public ExcelStream AsMultiRowConcatElements(string sep)
{
return new ExcelStream(Elements.Select(e => e.Row).ToList(), SelfTitle.FromIndex, SelfTitle.ToIndex, sep, SelfTitle.Default);
}
}

0 comments on commit 4c9086f

Please sign in to comment.