Skip to content

Commit 3e20409

Browse files
committed
fix: return error in data
1 parent 2b6cea2 commit 3e20409

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ class CoCreateUrlUploader {
3939
const response = await fetch(file.src);
4040

4141
if (!response.ok) {
42-
throw new Error('Failed to fetch file: ' + response.statusText);
42+
data.error = 'Failed to fetch file: ' + response.statusText
43+
if (data.socket)
44+
return this.crud.wsManager.send(data)
4345
}
4446

4547
const arrayBuffer = await response.arrayBuffer();
46-
file.src = arrayBufferToBase64(arrayBuffer)
48+
file.src = this.arrayBufferToBase64(arrayBuffer)
4749

4850
file.size = arrayBuffer.byteLength
4951
file['content-type'] = response.headers.get('content-type')

0 commit comments

Comments
 (0)