Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Transport/Import/SemanticValidationException.cs
T
Joseph Doherty 7b0b9c7365 refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj,
namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated.
ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated.
SQL roles/logins, LDAP domains, CLI command name, and CLI config dir
(~/.scadalink → ~/.scadabridge) also renamed.

Build green; 5 Host.Tests fail awaiting SQL login rename in next commit.
Pre-existing StaleTagMonitor timing flakes unchanged.

Rename script committed at tools/rename-to-scadabridge.sh.
2026-05-28 09:37:45 -04:00

40 lines
1.7 KiB
C#

namespace ZB.MOM.WW.ScadaBridge.Transport.Import;
/// <summary>
/// Thrown when the post-apply semantic validation pass detects that the merged
/// target configuration would not be deployable — e.g. a template script
/// references a SharedScript or ExternalSystem that exists in neither the
/// bundle nor the (post-merge) target database.
/// <para>
/// The exception is caught inside <see cref="BundleImporter.ApplyAsync"/> to
/// roll back the transaction, emit a <c>BundleImportFailed</c> audit row, and
/// re-throw to the caller so the UI can surface the specific errors. It is
/// deliberately distinct from <see cref="InvalidOperationException"/> so the
/// caller can distinguish "your bundle is bad" from "the import infra is bad".
/// </para>
/// </summary>
public sealed class SemanticValidationException : Exception
{
/// <summary>Gets the list of semantic validation error messages that caused this exception.</summary>
public IReadOnlyList<string> Errors { get; }
/// <summary>
/// Initializes a new <see cref="SemanticValidationException"/> with the given error list.
/// </summary>
/// <param name="errors">The list of validation error messages to include in the exception.</param>
public SemanticValidationException(IReadOnlyList<string> errors)
: base(BuildMessage(errors))
{
Errors = errors ?? throw new ArgumentNullException(nameof(errors));
}
private static string BuildMessage(IReadOnlyList<string> errors)
{
if (errors is null || errors.Count == 0)
{
return "Bundle semantic validation failed.";
}
return "Bundle semantic validation failed: " + string.Join("; ", errors);
}
}