So I want to throw an exception. But it contains more than just a String. something like this
class SomeException( val message : String, val someEnum : Emum, val customObject : CustomObject ): What should I extend it to? And is this even possible? I mean this exception is thrown in between microservices. throwing exceptions in rest calls should only have a string as message in it?
code: StringauserMessage: String(something that can be displayed to the end-user) and adeveloperMessage: String(further and more technical info for developers). If you're in Kotlin then extendingExceptionis fine. MaybeRuntimeExceptionif you're also dealing with Java.