You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error returned from supabase.storage.from(...).upload has a typescript issue. It it supposed to be returning a StorageError which should have a status as a number, but it seems to be returning some other exception which instead contains a statusCode as a string.
To Reproduce
Upload a file to a location where a file already exists.
const { data, error } = await supabase.storage.from(
'foos'
).upload(
'bar.txt',
someFile
);
if (error) {
console.log('error is', error);
}
if (error && error.statusCode !== "409") {
// 409 means we've already uploaded this photo
throw error;
}
Expected behavior
Logging the error shows:
error is {
statusCode: "409",
error: "Duplicate",
message: "The resource already exists"
}
However, error.statusCode results in the following typescript error:
Property 'statusCode' does not exist on type 'StorageError'.
The upload is supposed to return a StorageError
StorageError however has no such statusCode, so it seems that it is not returning a StorageError.
The text was updated successfully, but these errors were encountered:
Seconding this. The closest type I see in errors.ts is the StorageApiError type but it has a status property, not statusCode like we see in the error object.
Bug report
Describe the bug
The
error
returned fromsupabase.storage.from(...).upload
has a typescript issue. It it supposed to be returning aStorageError
which should have astatus
as a number, but it seems to be returning some other exception which instead contains astatusCode
as a string.To Reproduce
Upload a file to a location where a file already exists.
Expected behavior
Logging the error shows:
However,
error.statusCode
results in the following typescript error:The
upload
is supposed to return aStorageError
StorageError however has no such statusCode, so it seems that it is not returning a StorageError.
The text was updated successfully, but these errors were encountered: