CLOVIS
03/23/2023, 9:12 AMdave08
03/23/2023, 10:07 AMCLOVIS
03/23/2023, 10:08 AMdave08
03/23/2023, 10:09 AMCLOVIS
03/23/2023, 10:09 AMdave08
03/23/2023, 10:10 AMI don't want to duplicate the entire hierarchy for serialization.sounds like you need to send all of their contents anyways...?
CLOVIS
03/23/2023, 10:11 AMdave08
03/23/2023, 10:16 AMdata class Error(val code: Int, val name: String, message: String)
)? (How would you manage your contract with them otherwise?... I mean w/o copying over the while hierarchy... since it's not "just for serialization", but acting as an actual contract...) If so, it's just a matter of adding those fields to the base of the sealed class as an interface, and then just serializing that...Emil Kantis
03/23/2023, 10:30 AMfun BusinessError.toHttpBody() = when(this) {
is UserNotFound -> Error(404, "USER_NOT_FOUND", "User $id was not found")
is OperationNotAllowed -> Error(403, "SOMETHING", "...")
}
dave08
03/23/2023, 10:40 AMCLOVIS
03/23/2023, 10:42 AMEmil Kantis
03/23/2023, 10:45 AMError::code
and have a separate set of domain errors on the other sideCLOVIS
03/23/2023, 10:45 AMEmil Kantis
03/23/2023, 10:47 AMCLOVIS
03/23/2023, 10:48 AMEmil Kantis
03/23/2023, 10:52 AMCLOVIS
03/23/2023, 10:52 AMdave08
03/23/2023, 10:54 AMCLOVIS
03/23/2023, 10:55 AMdave08
03/23/2023, 10:58 AMCLOVIS
03/23/2023, 10:58 AMdave08
03/23/2023, 10:58 AMCLOVIS
03/23/2023, 11:09 AMdave08
03/23/2023, 11:27 AMCLOVIS
03/23/2023, 12:41 PMdave08
03/23/2023, 12:41 PMCLOVIS
03/23/2023, 12:42 PMdave08
03/23/2023, 12:42 PMCLOVIS
03/23/2023, 12:44 PMdave08
03/23/2023, 12:45 PMEmil Kantis
03/23/2023, 12:45 PMCLOVIS
03/23/2023, 12:45 PMEmil Kantis
03/23/2023, 12:50 PMdave08
03/27/2023, 9:14 AMCLOVIS
03/27/2023, 9:16 AMdave08
03/27/2023, 9:18 AM