remove redundant code and optimize exception throwing

This commit is contained in:
zgq
2024-03-28 14:49:40 +08:00
parent f425604b15
commit af467eb5fc
9 changed files with 54 additions and 228 deletions

View File

@ -1,6 +1,7 @@
package ai.chat2db.server.web.api.controller.rdb.data.export.strategy;
import ai.chat2db.server.domain.api.enums.ExportFileSuffix;
import ai.chat2db.server.tools.base.excption.BusinessException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.ByteArrayOutputStream;
@ -49,7 +50,7 @@ public class ExportDBData2JsonStrategy extends ExportDBDataStrategy {
String jsonString = objectMapper.writeValueAsString(data);
writer.println(jsonString);
} catch (IOException e) {
throw new RuntimeException(e);
throw new BusinessException();
}
}
}