Skip to content

Commit 71bf65d

Browse files
committed
test: Fix JacksonJsonCodecTest
1 parent 295abb8 commit 71bf65d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agentscope-core/src/main/java/io/agentscope/core/util/JacksonJsonCodec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public <T> T fromJson(String json, TypeReference<T> typeRef) {
129129
public <T> T convertValue(Object from, Class<T> toType) {
130130
try {
131131
return this.jsonMapper.convertValue(from, toType);
132-
} catch (IllegalArgumentException e) {
132+
} catch (IllegalArgumentException | JacksonException e) {
133133
throw new JsonException("Failed to convert value to " + toType.getName(), e);
134134
}
135135
}
@@ -138,7 +138,7 @@ public <T> T convertValue(Object from, Class<T> toType) {
138138
public <T> T convertValue(Object from, TypeReference<T> toTypeRef) {
139139
try {
140140
return this.jsonMapper.convertValue(from, toTypeRef);
141-
} catch (IllegalArgumentException e) {
141+
} catch (IllegalArgumentException | JacksonException e) {
142142
throw new JsonException("Failed to convert value", e);
143143
}
144144
}
@@ -148,7 +148,7 @@ public Object convertValue(Object from, Type toType) {
148148
try {
149149
JavaType javaType = this.jsonMapper.getTypeFactory().constructType(toType);
150150
return this.jsonMapper.convertValue(from, javaType);
151-
} catch (IllegalArgumentException e) {
151+
} catch (IllegalArgumentException | JacksonException e) {
152152
throw new JsonException("Failed to convert value to " + toType.getTypeName(), e);
153153
}
154154
}

0 commit comments

Comments
 (0)