|
18 | 18 | import javax.annotation.Nullable;
|
19 | 19 | import javax.annotation.concurrent.Immutable;
|
20 | 20 |
|
| 21 | +import org.eclipse.ditto.base.model.exceptions.DittoJsonException; |
| 22 | +import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException; |
| 23 | +import org.eclipse.ditto.base.model.headers.DittoHeaders; |
| 24 | +import org.eclipse.ditto.base.model.json.JsonParsableException; |
21 | 25 | import org.eclipse.ditto.json.JsonFieldSelectorInvalidException;
|
22 | 26 | import org.eclipse.ditto.json.JsonKeyInvalidException;
|
23 | 27 | import org.eclipse.ditto.json.JsonMissingFieldException;
|
24 | 28 | import org.eclipse.ditto.json.JsonObject;
|
25 | 29 | import org.eclipse.ditto.json.JsonParseException;
|
26 | 30 | import org.eclipse.ditto.json.JsonPointerInvalidException;
|
27 |
| -import org.eclipse.ditto.base.model.exceptions.DittoJsonException; |
28 |
| -import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException; |
29 |
| -import org.eclipse.ditto.base.model.headers.DittoHeaders; |
30 |
| -import org.eclipse.ditto.base.model.json.JsonParsableException; |
| 31 | +import org.eclipse.ditto.json.JsonRuntimeException; |
31 | 32 |
|
32 | 33 | /**
|
33 | 34 | * Contains all strategies to deserialize subclasses of {@link org.eclipse.ditto.base.model.exceptions.DittoRuntimeException} from a combination of
|
@@ -103,6 +104,13 @@ private static final class DittoJsonExceptionRegistry {
|
103 | 104 | private final Map<String, JsonParsable<DittoRuntimeException>> dittoJsonParseRegistries = new HashMap<>();
|
104 | 105 |
|
105 | 106 | private DittoJsonExceptionRegistry() {
|
| 107 | + dittoJsonParseRegistries.put(DittoJsonException.FALLBACK_ERROR_CODE, |
| 108 | + (jsonObject, dittoHeaders) -> new DittoJsonException( |
| 109 | + JsonRuntimeException.newBuilder(DittoJsonException.FALLBACK_ERROR_CODE) |
| 110 | + .message(getMessage(jsonObject)) |
| 111 | + .description(getDescription(jsonObject)) |
| 112 | + .build(), dittoHeaders)); |
| 113 | + |
106 | 114 | dittoJsonParseRegistries.put(JsonParseException.ERROR_CODE,
|
107 | 115 | (jsonObject, dittoHeaders) -> new DittoJsonException(
|
108 | 116 | JsonParseException.newBuilder()
|
|
0 commit comments