mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 14:47:18 +08:00
Simplify disposal exceptions
This commit is contained in:
parent
f78cedd0e1
commit
d4ea73d727
@ -84,11 +84,10 @@ namespace osu.Game.Database
|
|||||||
/// ie. to move the realm backing file to a new location.
|
/// ie. to move the realm backing file to a new location.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>An <see cref="IDisposable"/> which should be disposed to end the blocking section.</returns>
|
/// <returns>An <see cref="IDisposable"/> which should be disposed to end the blocking section.</returns>
|
||||||
/// <exception cref="InvalidOperationException">Thrown if this context is already disposed.</exception>
|
|
||||||
public IDisposable BlockAllOperations()
|
public IDisposable BlockAllOperations()
|
||||||
{
|
{
|
||||||
if (IsDisposed)
|
if (IsDisposed)
|
||||||
throw new InvalidOperationException(@"Attempted to block operations after already disposed.");
|
throw new ObjectDisposedException(nameof(RealmContextFactory));
|
||||||
|
|
||||||
blockingLock.Wait();
|
blockingLock.Wait();
|
||||||
flushContexts();
|
flushContexts();
|
||||||
@ -111,7 +110,7 @@ namespace osu.Game.Database
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsDisposed)
|
if (IsDisposed)
|
||||||
throw new InvalidOperationException(@"Attempted to retrieve a context after the factor has already been disposed.");
|
throw new ObjectDisposedException(nameof(RealmContextFactory));
|
||||||
|
|
||||||
blockingLock.Wait();
|
blockingLock.Wait();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user