Skip to content

Commit

Permalink
Fix unknown catch variable in project-management-automation
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Aug 30, 2021
1 parent 050294b commit 092cb5b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ const DAYS_PER_RELEASE = 14;
* Returns true if the given error object represents a duplicate entry error, or
* false otherwise.
*
* @param {RequestError} requestError Error to test.
* @param {unknown} requestError Error to test.
*
* @return {boolean} Whether error is a duplicate validation request error.
*/
const isDuplicateValidationError = ( requestError ) => {
// The included version of RequestError provides no way to access the
// full 'errors' array that the github REST API returns. Hopefully they
// resolve this soon!
return requestError.message.includes( 'already_exists' );
const errorMessage = /** @type {undefined | null | {message?: string}} */ ( requestError )
?.message;
return (
typeof errorMessage === 'string' &&
errorMessage.includes( 'already_exists' )
);
};

/**
Expand Down

0 comments on commit 092cb5b

Please sign in to comment.