@Override
@Caching
public ItemTypeDto getItemTypeDtoByName(String itemTypeName) throws EveDbException, InvalidItemTypeException {
try {
if (itemTypeName.length() == 0) {
throw new InvalidItemTypeException(itemTypeName, ErrorCode.NAME_CANNOT_BE_EMPTY);
}
InvTypeBasicInfoDto invTypeBasicInfoDto = client.getTypeBasicInfoByTypeName(itemTypeName);
return invTypeBasicInfoDto == null ? null : mapper.map(invTypeBasicInfoDto, ItemTypeDto.class);
} catch (BadRequestException e) {
logger.error("Caught BadRequestException", e.getMessage());
throw new InvalidItemTypeException(e.getMessage(), ErrorCode.INVALID_ITEM_TYPE);
} catch (RuntimeException e) {
logger.error("Caught RuntimeException", e);
throw new EveDbException(e);
}
}