mirror of https://github.com/Squidex/squidex.git
3 changed files with 49 additions and 3 deletions
@ -0,0 +1,46 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace Squidex.Infrastructure.Migrations |
|||
{ |
|||
[Serializable] |
|||
public class MigrationFailedException : Exception |
|||
{ |
|||
public string Name { get; } |
|||
|
|||
public MigrationFailedException(string name) |
|||
: base(FormatException(name)) |
|||
{ |
|||
Name = name; |
|||
} |
|||
|
|||
public MigrationFailedException(string name, Exception inner) |
|||
: base(FormatException(name), inner) |
|||
{ |
|||
Name = name; |
|||
} |
|||
|
|||
protected MigrationFailedException(SerializationInfo info, StreamingContext context) |
|||
: base(info, context) |
|||
{ |
|||
Name = info.GetString(nameof(Name)); |
|||
} |
|||
|
|||
public override void GetObjectData(SerializationInfo info, StreamingContext context) |
|||
{ |
|||
info.AddValue(nameof(Name), Name); |
|||
} |
|||
|
|||
private static string FormatException(string name) |
|||
{ |
|||
return $"Failed to run migration '{name}'"; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue