mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +08:00
Report any error during import to the write context to allow for rollback
This commit is contained in:
parent
cc081cad5a
commit
3d3026a80c
@ -180,6 +180,8 @@ namespace osu.Game.Database
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var write = ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes.
|
using (var write = ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes.
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}");
|
if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}");
|
||||||
|
|
||||||
@ -197,6 +199,12 @@ namespace osu.Game.Database
|
|||||||
// import to store
|
// import to store
|
||||||
ModelStore.Add(item);
|
ModelStore.Add(item);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
write.Errors.Add(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user