feat(storage): point a full trial account at the upgrade rather than at nothing

Being told "storage limit exceeded" when the limit is the free trial's three
gigabytes is a dead end. The account is not full because it stores a lot; it is
capped because it has not subscribed, and deleting files buys back very little.

The refusal now says which ceiling it is and carries its own error code, so the
toast can offer a link to the billing settings on the trial ceiling and stay
quiet on the paid one, where subscribing changes nothing.

The code had to survive the trip to the toast, which meant the upload helpers
throwing something that carries it rather than a bare Error. Two places were
dropping the server's message on the floor entirely: adding a version reported
"Failed to initialize upload" whatever the server said, and every asset upload
in the pane rewrote its own failure text.
This commit is contained in:
2026-08-18 11:42:30 +03:00
parent 63288761ed
commit 6561e0817e
10 changed files with 239 additions and 40 deletions
+15
View File
@@ -67,6 +67,12 @@ export const ErrorCode = {
// Storage errors
STORAGE_LIMIT_EXCEEDED: 'STORAGE_LIMIT_EXCEEDED',
/**
* Out of room because the account has not paid, rather than because the plan
* is full. Its own code so the client can offer the upgrade, which is the
* actual remedy here and is no help at all on the paid ceiling.
*/
TRIAL_STORAGE_LIMIT_EXCEEDED: 'TRIAL_STORAGE_LIMIT_EXCEEDED',
} as const;
/**
@@ -175,4 +181,13 @@ export const apiErrors = {
storageExceeded: (
message = 'Storage limit exceeded. Please delete some files to free up space.'
) => errorResponse(message, HttpStatus.INSUFFICIENT_STORAGE, ErrorCode.STORAGE_LIMIT_EXCEEDED),
/**
* The same 507, for an account that is out of room because it is on the free
* trial. Telling this caller to delete files is advice that does not apply:
* they have three gigabytes because they have not subscribed, not because they
* have filled two hundred.
*/
trialStorageExceeded: (message: string) =>
errorResponse(message, HttpStatus.INSUFFICIENT_STORAGE, ErrorCode.TRIAL_STORAGE_LIMIT_EXCEEDED),
};