SquareCloudBlobError
Every API failure throws a SquareCloudBlobError.
What is not a SquareCloudBlobError
- Network errors are not wrapped. When a request gets no complete response (DNS failure, connection reset, a body cut off mid-read), the original
fetcherror is thrown as-is, after any retries. - File errors. In Node.js, a
put()path that cannot be opened throws a plainError(Cannot open file: <path>, original error incause). In a browser, a path fails with the error from importingnode:fs. - A missing
@aws-sdk/client-s3.s3()throws the module import error.
UNKNOWN_ERROR
UNKNOWN_ERROR is the only code the SDK creates itself. It is used when the response has no error code: a non-JSON body (a proxy error page, for example) or a 2xx response without status: "success". status still holds the real HTTP status.
Per-object failures
Batch operations report failures in their result instead of throwing:update(): each result hasok: falseand acode.delete([ids]): missing objects go tonot_found, other failures tofailed.
Error codes
BlobErrorCode is the Blob Storage API’s own list of codes. It is not the same list as the main Square Cloud API’s error codes. For each code’s HTTP status and meaning, see the Blob API errors reference.
Global
Global
ACCESS_DENIED, RATE_LIMITED, MISSING_SCOPE, RESOURCE_NOT_ALLOWED, UPLOAD_TOKEN_NOT_ALLOWED, UPLOAD_TOKEN_USED, PREFIX_NOT_ALLOWED, PERMISSION_DENIED, ACCOUNT_BLOCKED, UPGRADE_REQUIRED, STORAGE_QUOTA_EXCEEDED, PRIVATE_STORAGE_UNAVAILABLE, PUBLIC_STORAGE_UNAVAILABLE, TOO_MANY_CONCURRENT_UPLOADS, UPLOAD_FAILED, INTERNAL_SERVER_ERROR, NOT_FOUNDRATE_LIMIT is deprecated: the service no longer sends it (see RATE_LIMITED), but it stays in the type.Objects
Objects
OBJECT_NOT_FOUND, OBJECT_ALREADY_EXISTS, OBJECT_IS_LEGACY, CHECKSUM_MISMATCH, INVALID_CONTENT_TYPE, FILE_TOO_LARGE, FILE_TOO_SMALL, BLOCKED_FILE_TYPE, INVALID_FILE_TYPE, FILE_TYPE_NOT_ALLOWED, NOTHING_TO_UPDATE, VISIBILITY_CHANGE_FAILED, UPDATE_FAILED, DELETE_FAILED, TOO_MANY_OBJECTS, SAME_OBJECT, INVALID_DESTINATION, COPY_FAILED, PREFIX_REQUIRED, INVALID_CONTINUATION_TOKENMultipart (chunked) uploads
Multipart (chunked) uploads
TOO_MANY_CONCURRENT_CHUNKS, TOO_MANY_OPEN_UPLOADS, INVALID_UPLOAD_TOKEN, UPLOAD_NOT_FOUND, NO_CHUNKS_UPLOADED, EMPTY_CHUNK, INVALID_CHUNK_PART, CHUNK_TOO_SMALL, CHUNK_TOO_LARGEValidation (400)
Validation (400)
Any
INVALID_* code, such as INVALID_OBJECT, INVALID_OBJECT_NAME or INVALID_RULE_PREFIX. Rule errors carry the offending prefix in error.extra.SDK
SDK
UNKNOWN_ERROR: the response had no error code (see above).BlobErrorCode also accepts any other string, so a code the service adds later still type-checks.
Retry policy
The SDK only retries what is safe to repeat:GET calls and multipart upload parts (each part number can be sent again).
A retryable call is retried on:
- a network error (including a body cut off mid-read);
- any
5xxresponse; TOO_MANY_CONCURRENT_CHUNKSon a multipart part: the server refuses the part before reading it, so it is sent again within the same budget.
4xx, including 429. RATE_LIMITED can be an account block that lasts about 30 minutes, so the SDK leaves the decision to you.
Backoff
Before retryn (starting at 0), the SDK waits:
maxRetries: 2, a call makes at most 3 attempts.
Retrying writes yourself
A write that fails with a network error or a5xx may or may not have been applied. Retry it only when repeating it is safe for you, for example a put() to the same name with overwrite: true.
Timeouts
There is no client timeout and no way to cancel a call: a request lasts as long asfetch waits.
