Skip to content

Commit

Permalink
CODE RUB: Posts Exceptions Upgrade v2.10.0
Browse files Browse the repository at this point in the history
Closes: #512
  • Loading branch information
glhays committed Aug 15, 2023
1 parent 7302783 commit b7c93c6
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 155 deletions.
18 changes: 11 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/AlreadyExistsPostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class AlreadyExistsPostException : Xeption
{
public AlreadyExistsPostException(Exception innerException)
: base(message: "Post with the same id already exists.", innerException)
{ }
}
}
public class AlreadyExistsPostException : Xeption
{
public AlreadyExistsPostException(Exception innerException)
: base(message: "Post with the same id already exists.", innerException)
{ }

public AlreadyExistsPostException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
18 changes: 11 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/FailedPostServiceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class FailedPostServiceException : Xeption
{
public FailedPostServiceException(Exception innerException)
: base(message: "Failed post service occurred, please contact support", innerException)
{ }
}
}
public class FailedPostServiceException : Xeption
{
public FailedPostServiceException(Exception innerException)
: base(message: "Failed post service occurred, please contact support", innerException)
{ }

public FailedPostServiceException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
18 changes: 11 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/FailedPostStorageException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class FailedPostStorageException : Xeption
{
public FailedPostStorageException(Exception innerException)
: base(message: "Failed post storage error occurred, contact support.", innerException)
{ }
}
}
public class FailedPostStorageException : Xeption
{
public FailedPostStorageException(Exception innerException)
: base(message: "Failed post storage error occurred, contact support.", innerException)
{ }

public FailedPostStorageException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
19 changes: 12 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/InvalidPostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using Xeptions;

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class InvalidPostException : Xeption
{
public InvalidPostException()
: base(message: "Invalid post. Please correct the errors and try again.")
{ }
}
}
public class InvalidPostException : Xeption
{
public InvalidPostException()
: base(message: "Invalid post. Please correct the errors and try again.")
{ }

public InvalidPostException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
19 changes: 13 additions & 6 deletions Taarafo.Core/Models/Posts/Exceptions/LockedPostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class LockedPostException : Xeption
{
public LockedPostException(Exception innerException)
: base(message: "Locked post record exception, please try again later", innerException) { }
}
}
public class LockedPostException : Xeption
{
public LockedPostException(Exception innerException)
: base(
message: "Locked post record exception, please try again later",
innerException: innerException)
{ }

public LockedPostException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
18 changes: 11 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/NotFoundPostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class NotFoundPostException : Xeption
{
public NotFoundPostException(Guid postId)
: base(message: $"Couldn't find post with id: {postId}.")
{ }
}
}
public class NotFoundPostException : Xeption
{
public NotFoundPostException(Guid postId)
: base(
message: $"Couldn't find post with id: {postId}.")
{ }

public NotFoundPostException(string message, Exception innerException)
: base(message, innerException) { }
}
}
18 changes: 11 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/NullPostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using Xeptions;

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class NullPostException : Xeption
{
public NullPostException()
: base(message: "Post is null.")
{ }
}
}
public class NullPostException : Xeption
{
public NullPostException()
: base(message: "Post is null.")
{ }

public NullPostException(string message, Exception innerException)
: base(message, innerException) { }
}
}
20 changes: 13 additions & 7 deletions Taarafo.Core/Models/Posts/Exceptions/PostDependencyException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using Xeptions;

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class PostDependencyException : Xeption
{
public PostDependencyException(Xeption innerException) :
base(message: "Post dependency error occurred, contact support.", innerException)
{ }
}
}
public class PostDependencyException : Xeption
{
public PostDependencyException(Xeption innerException) :
base(
message: "Post dependency error occurred, contact support.",
innerException: innerException)
{ }

public PostDependencyException(string message, Exception innerException)
: base(message, innerException) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class PostDependencyValidationException : Xeption
{
public PostDependencyValidationException(Xeption innerException)
: base(message: "Post dependency validation occurred, please try again.", innerException)
{ }
}
}
public class PostDependencyValidationException : Xeption
{
public PostDependencyValidationException(Xeption innerException)
: base(
message: "Post dependency validation occurred, please try again.",
innerException: innerException)
{ }

public PostDependencyValidationException(string message, Xeption innerException)
: base(message, innerException) { }
}
}
17 changes: 11 additions & 6 deletions Taarafo.Core/Models/Posts/Exceptions/PostServiceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class PostServiceException : Xeption
{
public PostServiceException(Exception innerException)
: base(message: "Post service error occurred, contact support.", innerException) { }
}
}
public class PostServiceException : Xeption
{
public PostServiceException(Exception innerException)
: base(
message: "Post service error occurred, contact support.",
innerException: innerException) { }

public PostServiceException(string message, Exception innerException)
: base(message, innerException) { }
}
}
20 changes: 12 additions & 8 deletions Taarafo.Core/Models/Posts/Exceptions/PostValidationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@

namespace Taarafo.Core.Models.Posts.Exceptions
{
public class PostValidationException : Xeption
{
public PostValidationException(Xeption innerException)
: base(message: "Post validation errors occurred, please try again.",
innerException)
{ }
}
}
public class PostValidationException : Xeption
{
public PostValidationException(Xeption innerException)
: base(
message: "Post validation errors occurred, please try again.",
innerException: innerException)
{ }

public PostValidationException(string message, Xeption innerException)
: base(message, innerException) { }
}
}
2 changes: 1 addition & 1 deletion Taarafo.Core/Models/Posts/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public class Post
public IEnumerable<Comment> Comments { get; set; }
public IEnumerable<PostImpression> PostImpressions { get; set; }
}
}
}
18 changes: 9 additions & 9 deletions Taarafo.Core/Services/Foundations/Posts/IPostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

namespace Taarafo.Core.Services.Foundations.Posts
{
public interface IPostService
{
ValueTask<Post> AddPostAsync(Post post);
ValueTask<Post> RetrievePostByIdAsync(Guid postId);
IQueryable<Post> RetrieveAllPosts();
ValueTask<Post> ModifyPostAsync(Post post);
ValueTask<Post> RemovePostByIdAsync(Guid postId);
}
}
public interface IPostService
{
ValueTask<Post> AddPostAsync(Post post);
ValueTask<Post> RetrievePostByIdAsync(Guid postId);
IQueryable<Post> RetrieveAllPosts();
ValueTask<Post> ModifyPostAsync(Post post);
ValueTask<Post> RemovePostByIdAsync(Guid postId);
}
}
Loading

0 comments on commit b7c93c6

Please sign in to comment.