Commit e3b5b231 authored by wenmo's avatar wenmo

[Fix-98][admin,web] Fix to show exception

parent f0692faf
......@@ -9,7 +9,9 @@ import com.dlink.job.JobResult;
import com.dlink.result.IResult;
import com.dlink.service.StudioService;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -60,7 +62,11 @@ public class StudioController {
*/
@PostMapping("/getJobPlan")
public Result getJobPlan(@RequestBody StudioExecuteDTO studioExecuteDTO) {
try {
return Result.succeed(studioService.getJobPlan(studioExecuteDTO), "获取作业计划成功");
} catch (Exception e) {
return Result.failed("目前只支持获取 INSERT 语句的作业计划");
}
}
/**
......
package com.dlink.exception;
import cn.dev33.satoken.exception.NotLoginException;
import com.dlink.common.result.Result;
import com.dlink.model.CodeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
......@@ -41,6 +43,6 @@ public class WebExceptionHandler {
@ExceptionHandler
public Result unknownException(Exception e) {
logger.error("ERROR:", e);
return Result.failed("系统出现错误, 请联系平台管理员!");
return Result.failed(e.getMessage());
}
}
package com.dlink.core;
import com.dlink.executor.Executor;
import com.dlink.interceptor.FlinkInterceptor;
import org.junit.Assert;
import org.junit.Test;
/**
* FlinkInterceptorTest
*
* @author wenmo
* @since 2022/4/9 17:48
**/
public class FlinkInterceptorTest {
@Test
public void replaceFragmentTest(){
String statement = "nullif1:=NULLIF(1, 0) as val;" +
"nullif2:=NULLIF(0, 0) as val$null;" +
"select ${nullif1},${nullif2}";
String pretreatStatement = FlinkInterceptor.pretreatStatement(Executor.build(), statement);
Assert.assertEquals("select NULLIF(1, 0) as val,NULLIF(0, 0) as val$null",pretreatStatement);
}
}
......@@ -198,9 +198,10 @@ const StudioMenu = (props: any) => {
const res = getJobPlan(param);
handleGraphModalVisible(true);
res.then((result) => {
if (result.code == 0) {
if (result.code == CODE.SUCCESS) {
setGraphData(buildGraphData(result.datas));
} else {
message.error(`获取作业执行计划失败,原因:\n${result.msg}`);
setGraphData(undefined);
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment