Skip to content

Commit bd6e796

Browse files
committed
added default error message for errors with status code 401
1 parent e5514c0 commit bd6e796

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

client/src/main/java/io/apistax/client/APIstaxClientImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ private <T> T request(String path, BodyProvider body, String accept, Map<String,
191191
var errorMessage = objectMapper.readValue(response.body(), ErrorMessage.class);
192192
throw new APIstaxException(errorMessage.getMessages());
193193
} catch (IOException e) {
194+
if(response.statusCode() == 401) {
195+
throw new APIstaxException(List.of("message.forbidden"), e);
196+
}
197+
194198
throw new APIstaxException(List.of("message.unknownError"), e);
195199
}
196200
}

0 commit comments

Comments
 (0)