Commit 4e8553a71beb0809e563e9a657b3edf2f12e387b
Merge branch 'fix/product-import' into 'master_dev'
fix:产品导入与云边同出错国际化显示 See merge request yunteng/thingskit!450
Showing
2 changed files
with
10 additions
and
1 deletions
... | ... | @@ -386,6 +386,10 @@ public abstract class BaseController { |
386 | 386 | log.warn("Database error: {} - {}", errorType, ExceptionUtils.getRootCauseMessage(exception)); |
387 | 387 | } |
388 | 388 | return new ThingsboardException("Database error", ThingsboardErrorCode.GENERAL); |
389 | + } else if(exception instanceof org.springframework.http.converter.HttpMessageNotReadableException){ | |
390 | + if(exception.getCause() instanceof com.fasterxml.jackson.databind.exc.InvalidFormatException){ | |
391 | + return new ThingsboardException(MessageUtils.message(ErrorMessage.INVALID_PARAMETER.getI18nCode()), exception, ThingsboardErrorCode.BAD_REQUEST_PARAMS); | |
392 | + } | |
389 | 393 | } |
390 | 394 | return new ThingsboardException(exception.getMessage(), exception, ThingsboardErrorCode.GENERAL); |
391 | 395 | } | ... | ... |
... | ... | @@ -53,6 +53,9 @@ import org.thingsboard.server.common.data.page.PageLink; |
53 | 53 | import org.thingsboard.server.common.data.rule.RuleChain; |
54 | 54 | import org.thingsboard.server.common.data.sync.ie.importing.csv.BulkImportRequest; |
55 | 55 | import org.thingsboard.server.common.data.sync.ie.importing.csv.BulkImportResult; |
56 | +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | |
57 | +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | |
58 | +import org.thingsboard.server.common.data.yunteng.utils.i18n.MessageUtils; | |
56 | 59 | import org.thingsboard.server.common.msg.edge.FromEdgeSyncResponse; |
57 | 60 | import org.thingsboard.server.common.msg.edge.ToEdgeSyncRequest; |
58 | 61 | import org.thingsboard.server.dao.attributes.AttributesDao; |
... | ... | @@ -541,7 +544,9 @@ public class EdgeController extends BaseController { |
541 | 544 | if (fromEdgeSyncResponse.isSuccess()) { |
542 | 545 | response.setResult(new ResponseEntity<>(HttpStatus.OK)); |
543 | 546 | } else { |
544 | - response.setErrorResult(new ThingsboardException("Edge is not connected", ThingsboardErrorCode.GENERAL)); | |
547 | + //thingskit code 国际化 | |
548 | +// response.setErrorResult(new ThingsboardException("Edge is not connected", ThingsboardErrorCode.GENERAL)); | |
549 | + response.setErrorResult(new TkDataValidationException(MessageUtils.message(ErrorMessage.NETWORK_TIMEOUT.getI18nCode()))); | |
545 | 550 | } |
546 | 551 | } |
547 | 552 | ... | ... |