Skip to content

Commit

Permalink
Merge pull request #259 from hassanhabib/users/glhays/documentations-…
Browse files Browse the repository at this point in the history
…v2.10.0-reviews

DOCUMENTATIONS: V2.10.0 Review Updates
  • Loading branch information
hassanhabib authored Aug 7, 2023
2 parents 0667b4d + 84412b1 commit 8dda80b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions 2. Services/2.1 Foundations/2.1 Foundations.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public class Student
}
```

Assuming that the passed in `Student` model is not null, but it has default values across the board for all it's properties. We want to collect all these issues for however many attributes/properties this object has and return a full report back to the requestor. Here's how to do it.
Assuming that the passed-in `Student` model is not null, it has default values across the board for all its properties. We want to collect all these issues for however many attributes/properties this object has and return a full report back to the requestor. Here's how to do it.

#### 2.1.3.1.1.0 Upsertable Exceptions

Expand Down Expand Up @@ -344,9 +344,9 @@ public class InvalidStudentException : Xeption
}
```

Every custom exception whether is localized or categorized will essentially have two different constructors. The first constructor embeds the exception `message` to easy the utilization of the exception. The second constructor is mainly for testing to ensure messages communicated through the exception are the proper messages.
Every custom exception whether it is localized or categorized will essentially have two different constructors. The first constructor embeds the exception `message` to ease the utilization of the exception. The second constructor is mainly for testing to ensure messages communicated through the exception are the proper messages.

But with continuous validations, the process of collecting these errors conveys more than just a special exception implementation. Let's talk about that in the next section.
But with continuous validations, the process of collecting these errors conveys more than just a special exception implementation. We will discuss more on this in the next section.

#### 2.1.3.1.1.1 Dynamic Rules

Expand Down Expand Up @@ -556,9 +556,9 @@ public async void ShouldThrowValidationExceptionOnRegisterWhenIdIsInvalidAndLogI
broker.InsertStudentAsync(It.IsAny<Student>()),
Times.Never);

this.dateTimeBrokerMock.VerifyNoOtherCalls();
this.loggingBrokerMock.VerifyNoOtherCalls();
this.storageBrokerMock.VerifyNoOtherCalls();
this.dateTimeBrokerMock.VerifyNoOtherCalls();
}
```

Expand All @@ -582,15 +582,15 @@ public class InvalidStudentException : Xeption
}
```

The above unit test however, requires our `InvalidStudentException` to be wrapped up in a more generic system-level exception, which is `StudentValidationException` - these exceptions is what I call outer-exceptions, they encapsulate all the different situations of validations regardless of their category and communicates the error to upstream services or controllers so they can map that to the proper error code to the consumer of these services.
The above unit test however, requires our `InvalidStudentException` to be wrapped up in a more generic system-level exception, which is `StudentValidationException` - these exceptions are what I call outer-exceptions, they encapsulate all the different situations of validations regardless of their category and communicates the error to upstream services or controllers so they can map that to the proper error code to the consumer of these services.

Our `StudentValidationException` would be implemented as follows:

```csharp
public class StudentValidationException : Exception
{
public StudentValidationException(Exception innerException)
: base("Student validation error occurred, please check your input and then try again.",
: base("Student validation error occurred, please check your input and try again.",
innerException) { }

public StudentValidationException(string message, Exception innerException)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The Standard

[![The Standard](https://img.shields.io/github/v/release/hassanhabib/The-Standard?style=plastic&label=Standard%20Version&labelColor=6E8AD6&color=0D1117)](https://github.com/hassanhabib/The-Standard)
[![The Standard Community](https://img.shields.io/discord/934130100008538142?style=plastic&color=%237289da&label=The%20Standard%20Community&logo=Discord)](https://discord.gg/vdPZ7hS52X)
[![The Standard](https://img.shields.io/github/v/release/hassanhabib/The-Standard?filter=v2.10.0&style=default&label=Standard%20Version&color=2ea44f)](https://github.com/hassanhabib/The-Standard)
[![The Standard Community](https://img.shields.io/discord/934130100008538142?style=default&color=%237289da&label=The%20Standard%20Community&logo=Discord)](https://discord.gg/vdPZ7hS52X)

Chat with us here on Discord:

Expand Down

0 comments on commit 8dda80b

Please sign in to comment.