mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
// ==========================================================================
|
|
// 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, Exception? inner = null)
|
|
: 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}'";
|
|
}
|
|
}
|
|
}
|
|
|