Skip to content

Commit

Permalink
Merge pull request #25 from The-Standard-Organization/users/cjdutoit/…
Browse files Browse the repository at this point in the history
…coderub-abstraction-exceptions

CODE RUB: Extended exceptions to take an inner exception
  • Loading branch information
cjdutoit authored Feb 20, 2024
2 parents 4e473a2 + dc2a32c commit 56a1ac2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Microsoft.EntityFrameworkCore;

namespace STX.EFxceptions.Abstractions.Models.Exceptions
{
public class DuplicateKeyException : DbUpdateException
{
public DuplicateKeyException(string message) : base(message) { }

public DuplicateKeyException(string message, Exception innerException) : base(message, innerException) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Microsoft.EntityFrameworkCore;

namespace STX.EFxceptions.Abstractions.Models.Exceptions
Expand All @@ -20,5 +21,16 @@ public DuplicateKeyWithUniqueIndexException(string message)
DuplicateKeyValue = subStrings[1];
}
}

public DuplicateKeyWithUniqueIndexException(string message, Exception innerException)
: base(message, innerException)
{
string[] subStrings = message.Split('(', ')');

if (subStrings.Length == 3)
{
DuplicateKeyValue = subStrings[1];
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Microsoft.EntityFrameworkCore;

namespace STX.EFxceptions.Abstractions.Models.Exceptions
{
public class ForeignKeyConstraintConflictException : DbUpdateException
{
public ForeignKeyConstraintConflictException(string message) : base(message) { }

public ForeignKeyConstraintConflictException(string message, Exception innerException)
: base(message, innerException) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Microsoft.EntityFrameworkCore;

namespace STX.EFxceptions.Abstractions.Models.Exceptions
{
public class InvalidColumnNameException : DbUpdateException
{
public InvalidColumnNameException(string message) : base(message) { }
public InvalidColumnNameException(string message, Exception innerException) : base(message, innerException) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Microsoft.EntityFrameworkCore;

namespace STX.EFxceptions.Abstractions.Models.Exceptions
{
public class InvalidObjectNameException : DbUpdateException
{
public InvalidObjectNameException(string message) : base(message) { }
public InvalidObjectNameException(string message, Exception innerException) : base(message, innerException) { }
}
}

0 comments on commit 56a1ac2

Please sign in to comment.