Skip to content

Commit b93bf44

Browse files
committed
switch to nuxtError due to ci issues
1 parent f9475fd commit b93bf44

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

server/utils/changelog/detectChangelog.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import type {
66
import type { FetchError } from 'ofetch'
77
import type { ExtendedPackageJson } from '~~/shared/utils/package-analysis'
88
import { type RepoRef, parseRepoUrl } from '~~/shared/utils/git-providers'
9+
import { type NuxtError, createError, isNuxtError } from 'nuxt/app'
910
import { ERROR_CHANGELOG_NOT_FOUND, ERROR_UNGH_API_KEY_EXHAUSTED } from '~~/shared/utils/constants'
10-
import * as v from 'valibot'
11-
import { H3Error } from 'h3'
1211
import { GithubReleaseSchama } from '~~/shared/schemas/changelog/release'
1312
import { resolveURL } from 'ufo'
13+
import * as v from 'valibot'
1414

1515
/**
1616
* Detect whether changelogs/releases are available for this package
@@ -28,7 +28,7 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
2828
}
2929

3030
const releases = await checkReleases(repoRef, pkg.repository.directory)
31-
if (releases && !(releases instanceof H3Error)) {
31+
if (releases && !isNuxtError(releases)) {
3232
return releases
3333
}
3434

@@ -37,7 +37,7 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
3737
return changelog
3838
}
3939

40-
if (releases instanceof H3Error) {
40+
if (isNuxtError(releases)) {
4141
throw releases
4242
}
4343

@@ -49,12 +49,12 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
4949

5050
/**
5151
* check whether releases are being used with this repo
52-
* @returns true if in use, false if not in use or an H3Error in case of ungh's api keys being exhausted
52+
* @returns true if in use, false if not in use or an NuxtError in case of ungh's api keys being exhausted
5353
*/
5454
async function checkReleases(
5555
ref: RepoRef,
5656
directory?: string,
57-
): Promise<ChangelogInfo | false | H3Error> {
57+
): Promise<ChangelogInfo | false | NuxtError> {
5858
switch (ref.provider) {
5959
case 'github': {
6060
return checkLatestGithubRelease(ref, directory)
@@ -72,7 +72,7 @@ const ROOT_ONLY_REGEX = /^\/[^/]+$/
7272
function checkLatestGithubRelease(
7373
ref: RepoRef,
7474
directory?: string,
75-
): Promise<ChangelogInfo | false | H3Error> {
75+
): Promise<ChangelogInfo | false | NuxtError> {
7676
return $fetch(`https://ungh.cc/repos/${ref.owner}/${ref.repo}/releases/latest`)
7777
.then(r => {
7878
const { release } = v.parse(v.object({ release: GithubReleaseSchama }), r)

0 commit comments

Comments
 (0)