Skip to content

Commit e547054

Browse files
committed
fix: Correctly handle abort error
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 2ae90e0 commit e547054

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/mixins/FetchFilesMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default {
102102
logger.error('Fail to create source directory', { error })
103103
}
104104
}
105-
} else if (error.code === 'ERR_CANCELED') {
105+
} else if (error instanceof DOMException && error.code === error.ABORT_ERR) {
106106
return []
107107
} else {
108108
this.errorFetchingFiles = error

src/services/Albums.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function fetchAlbum(path, options, extraProps = '', client = davCli
6363

6464
return formatAlbum(response.data)
6565
} catch (error) {
66-
if (error.code === 'ERR_CANCELED') {
66+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
6767
return null
6868
}
6969

@@ -93,7 +93,7 @@ export async function fetchAlbums(path, options, extraProps = '', client = davCl
9393
.filter(album => album.filename !== path)
9494
.map(formatAlbum)
9595
} catch (error) {
96-
if (error.code === 'ERR_CANCELED') {
96+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
9797
return []
9898
}
9999

@@ -163,7 +163,7 @@ export async function fetchAlbumContent(path, options, client = davClient) {
163163

164164
return fetchedFiles
165165
} catch (error) {
166-
if (error.code === 'ERR_CANCELED') {
166+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
167167
return []
168168
}
169169

src/services/collectionFetcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export async function fetchCollection(path, options, extraProps = [], client = d
9999

100100
return formatCollection(response.data)
101101
} catch (error) {
102-
if (error.code === 'ERR_CANCELED') {
102+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
103103
return null
104104
}
105105

@@ -129,7 +129,7 @@ export async function fetchCollections(path, options, extraProps = [], client =
129129
.filter(collection => collection.filename !== path)
130130
.map(formatCollection)
131131
} catch (error) {
132-
if (error.code === 'ERR_CANCELED') {
132+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
133133
return []
134134
}
135135

@@ -200,7 +200,7 @@ export async function fetchCollectionFiles(path, options, extraProps = [], clien
200200

201201
return fetchedFiles
202202
} catch (error) {
203-
if (error.code === 'ERR_CANCELED') {
203+
if (error instanceof DOMException && error.code === error.ABORT_ERR) {
204204
return []
205205
}
206206

0 commit comments

Comments
 (0)