-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(releases): handling cases where no create release permissions whi…
…lst at limit of release in project (#8644) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
- Loading branch information
1 parent
dc2d261
commit 37846d5
Showing
6 changed files
with
27 additions
and
15 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type ErrorWithDetails = {details?: {type?: string}} | ||
|
||
export const isErrorWithDetails = (error: unknown): error is ErrorWithDetails => | ||
typeof error === 'object' && | ||
error !== null && | ||
'details' in error && | ||
typeof (error as {details: unknown}).details === 'object' |
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
11 changes: 3 additions & 8 deletions
11
packages/sanity/src/core/releases/store/isReleaseLimitError.ts
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 |
---|---|---|
@@ -1,11 +1,6 @@ | ||
type ErrorWithDetails = {details?: {type?: string}} | ||
type ReleaseLimitError = {details: {type: 'releaseLimitExceededError'; limit: number}} | ||
import {isErrorWithDetails} from '../../error/types/isErrorWithDetails' | ||
|
||
const hasDetails = (error: unknown): error is ErrorWithDetails => | ||
typeof error === 'object' && | ||
error !== null && | ||
'details' in error && | ||
typeof (error as {details: unknown}).details === 'object' | ||
type ReleaseLimitError = {details: {type: 'releaseLimitExceededError'; limit: number}} | ||
|
||
export const isReleaseLimitError = (error: unknown): error is ReleaseLimitError => | ||
hasDetails(error) && error.details?.type === 'releaseLimitExceededError' | ||
isErrorWithDetails(error) && error.details?.type === 'releaseLimitExceededError' |
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