-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225 #1257
Merged
jsonwan
merged 7 commits into
TencentBlueKing:3.5.x
from
jsonwan:github_fix/notify_preview
Sep 7, 2022
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7eb0b3b
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan 8e83e74
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan 3f529f9
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan 018f41e
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan 979dea6
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan c975b29
bugfix: 默认通知策略下定时任务执行失败不通知 #1262
jsonwan a5e8741
bugfix: 全局设置消息预览在发送失败的情况下仍提示发送成功 #1225
jsonwan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ommons/paas-sdk/src/main/java/com/tencent/bk/job/common/paas/exception/PaasException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.common.paas.exception; | ||
|
||
import com.tencent.bk.job.common.exception.ServiceException; | ||
import com.tencent.bk.job.common.model.error.ErrorType; | ||
|
||
public class PaasException extends ServiceException { | ||
|
||
public PaasException(ErrorType errorType, Integer errorCode, Object[] errorParams) { | ||
super(errorType, errorCode, errorParams); | ||
} | ||
|
||
public PaasException(Throwable cause, ErrorType errorType, Integer errorCode, Object[] errorParams) { | ||
super(cause, errorType, errorCode, errorParams); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ | |
import com.tencent.bk.job.common.exception.InternalException; | ||
import com.tencent.bk.job.common.metrics.CommonMetricNames; | ||
import com.tencent.bk.job.common.model.dto.BkUserDTO; | ||
import com.tencent.bk.job.common.model.error.ErrorType; | ||
import com.tencent.bk.job.common.paas.exception.PaasException; | ||
import com.tencent.bk.job.common.paas.metrics.PaaSMetricTags; | ||
import com.tencent.bk.job.common.paas.model.EsbListUsersResult; | ||
import com.tencent.bk.job.common.paas.model.EsbNotifyChannelDTO; | ||
|
@@ -113,7 +115,7 @@ public List<BkUserDTO> getUserList(String fields, | |
} catch (Exception e) { | ||
String errorMsg = "Get " + API_GET_USER_LIST + " error"; | ||
log.error(errorMsg, e); | ||
throw new InternalException(errorMsg, e, ErrorCode.PAAS_API_DATA_ERROR); | ||
throw new InternalException(errorMsg, e, ErrorCode.USER_MANAGE_API_ACCESS_ERROR); | ||
} finally { | ||
HttpMetricUtil.clearHttpMetric(); | ||
} | ||
|
@@ -170,7 +172,7 @@ public List<EsbNotifyChannelDTO> getNotifyChannelList(String uin) { | |
} | ||
|
||
@Override | ||
public boolean sendMsg( | ||
public void sendMsg( | ||
String msgType, | ||
String sender, | ||
Set<String> receivers, | ||
|
@@ -194,14 +196,21 @@ public boolean sendMsg( | |
|
||
if (esbResp.getResult() == null || !esbResp.getResult() || esbResp.getCode() != 0) { | ||
status = checkRespAndGetStatus(uri, esbResp); | ||
return false; | ||
throw new PaasException( | ||
ErrorType.FAILED_PRECONDITION, | ||
ErrorCode.CMSI_FAIL_TO_SEND_MSG, | ||
new Object[]{ | ||
esbResp.getCode().toString(), | ||
esbResp.getMessage() | ||
}); | ||
} | ||
status = EsbMetricTags.VALUE_STATUS_SUCCESS; | ||
return true; | ||
} catch (PaasException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
log.error("Fail to request {}", uri, e); | ||
status = EsbMetricTags.VALUE_STATUS_ERROR; | ||
return false; | ||
throw new PaasException(e, ErrorType.FAILED_PRECONDITION, ErrorCode.CMSI_API_ACCESS_ERROR, new Object[]{}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ErrorType不对 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已修改 |
||
} finally { | ||
HttpMetricUtil.clearHttpMetric(); | ||
recordMetrics(start, status, msgType); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个接口调用失败似乎应该是INTERNAL_ERROR,而不是FAILED_PRECONDITION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改