wultra / lime-java-core

Core Java classes shared across our projects
Apache License 2.0
4 stars 3 forks source link

Enable deserialization of ErrorResponse subtypes #32

Open romanstrobl opened 3 years ago

romanstrobl commented 3 years ago

The DefaultRestClient can currently deserialize only the ErrorResponse type, but it fails to deserialize subtypes of the ErrorResponse. We should introduce a configuration option which allows to map error codes to types dynamically and allow to deserialize custom error responses which usually contain additional error data such as validation errors.

romanstrobl commented 3 years ago

The use case of custom error handling can be handled in the client code, see: https://github.com/wultra/powerauth-webflow/blob/3c0a09da6a6f02ea1ade00c37c8b85625c85d460/powerauth-nextstep-client/src/main/java/io/getlime/security/powerauth/lib/nextstep/client/NextStepClientException.java#L131

Although this solution is far from ideal when considering the code style, technically it work fine, so we can postpone this issue to the next release.