silence channel_not_found warning

This commit is contained in:
Ron Rennick 2021-03-31 10:08:00 -03:00
parent a720f00a2d
commit 8cb816add9
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const { createReadStream } = require( 'fs' );
const { WebClient, ErrorCode } = require( '@slack/web-api' );
const { getTestConfig } = require( '../../utils' );
const {
GITHUB_ACTIONS,
GITHUB_REF,
@ -37,10 +38,11 @@ const initializeSlack = () => {
return false;
}
if ( ! GITHUB_ACTIONS && ! TRAVIS_PULL_REQUEST_BRANCH ) {
const testConfig = getTestConfig();
return {
branch: 'local environment',
commit: 'latest',
webUrl: 'http:://localhost',
webUrl: testConfig.url,
};
}
// Build PR info
@ -84,7 +86,9 @@ export async function sendFailedTestMessageToSlack( testName ) {
// Check the code property and log the response
if ( error.code === ErrorCode.PlatformError || error.code === ErrorCode.RequestError ||
error.code === ErrorCode.RateLimitedError || error.code === ErrorCode.HTTPError ) {
console.log( error.data );
if ( error.data.error != 'channel_not_found' ) {
console.log(error.data);
}
} else {
// Some other error, oh no!
console.log(