diff --git a/catalog/docs/failure-error-handling/failure-class-diagram.puml b/catalog/docs/failure-error-handling/failure-class-diagram.puml new file mode 100644 index 0000000..708ff76 --- /dev/null +++ b/catalog/docs/failure-error-handling/failure-class-diagram.puml @@ -0,0 +1,53 @@ +@startuml Failure Class Diagram +abstract BaseFailure { + - String BASE_FAILURE_MESSAGE = "failure" + + String message = this.BASE_FAILURE_MESSAGE + + constructor(key: string) +} + +class UserFailure { + constructor(key: string) +} + +note left + Extends parent message key by sending + `user` keyword as a domain to parent. + So in `UserFailure` our `message` + property will be `failure.user`. +end note + +UserFailure --|> BaseFailure + + +class UserModificationFailure { + constructor(key: string) +} +note right + Extends parent message key by sending + `modification` keyword to parent. + So in `UserModificationFailure` our `message` + property will be `failure.user.modification` +end note +UserModificationFailure --|> UserFailure + +class UserModificationAlreadyExistsFailure { + constructor() +} +note left + Extends parent message key by sending + `alreadyExists` keyword to parent. + So in `UserModificationAlreadyExistsFailure` + our `message` property will be + `failure.user.modification.AlreadyExists` +end note + +class DeviceFailure { + constructor() +} + +DeviceFailure --|> BaseFailure +UserModificationAlreadyExistsFailure --|> UserModificationFailure + + +@enduml \ No newline at end of file diff --git a/catalog/docs/failure-error-handling/failure-class-diagram.svg b/catalog/docs/failure-error-handling/failure-class-diagram.svg new file mode 100644 index 0000000..7eab9a2 --- /dev/null +++ b/catalog/docs/failure-error-handling/failure-class-diagram.svg @@ -0,0 +1 @@ +BaseFailureString BASE_FAILURE_MESSAGE = "failure"String message = this.BASE_FAILURE_MESSAGEconstructor(key: string)UserFailureconstructor(key: string)Extends parent message key by sending`user` keyword as a domain to parent.So in `UserFailure` our `message` property will be `failure.user`.UserModificationFailureconstructor(key: string)Extends parent message key by sending`modification` keyword to parent.So in `UserModificationFailure` our `message` property will be `failure.user.modification`UserModificationAlreadyExistsFailureconstructor()Extends parent message key by sending`alreadyExists` keyword to parent.So in `UserModificationAlreadyExistsFailure` our `message`property will be`failure.user.modification.AlreadyExists`DeviceFailureconstructor() \ No newline at end of file diff --git a/catalog/docs/failure-error-handling.md b/catalog/docs/failure-error-handling/failure-error-handling.md similarity index 98% rename from catalog/docs/failure-error-handling.md rename to catalog/docs/failure-error-handling/failure-error-handling.md index 093a18a..e8a96b9 100644 --- a/catalog/docs/failure-error-handling.md +++ b/catalog/docs/failure-error-handling/failure-error-handling.md @@ -212,4 +212,6 @@ if (!isLeft(usecaseResponse)) return; if (!(usecaseResponse instanceOf BaseFailure)) return; const translatedFailureMessage = t(usecaseResponse.left.message) -``` \ No newline at end of file +``` +This is the final version, class diagram for our failur architecture: +![Failure class diagram](./failure-class-diagram.svg)