Skip to content

Commit 97fe81a

Browse files
authored
File quota error message (#797)
1 parent 5bc5510 commit 97fe81a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/deploy.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ class DeployBuildEffects implements BuildEffects {
353353
try {
354354
await this.apiClient.postDeployFile(this.deployId, sourcePath, outputPath);
355355
} catch (error) {
356+
if (isApiError(error) && error.details.errors.some((e) => e.code === "FILE_QUOTA_EXCEEDED")) {
357+
throw new CliError("You have reached the total file size limit.", {cause: error});
358+
}
356359
// 413 is "Payload Too Large", however sometimes Cloudflare returns a
357360
// custom Cloudflare error, 520. Sometimes we also see 502. Handle them all
358361
if (isHttpError(error) && (error.statusCode === 413 || error.statusCode === 503 || error.statusCode === 520)) {
@@ -363,7 +366,14 @@ class DeployBuildEffects implements BuildEffects {
363366
}
364367
async writeFile(outputPath: string, content: Buffer | string) {
365368
this.logger.log(outputPath);
366-
await this.apiClient.postDeployFileContents(this.deployId, content, outputPath);
369+
try {
370+
await this.apiClient.postDeployFileContents(this.deployId, content, outputPath);
371+
} catch (error) {
372+
if (isApiError(error) && error.details.errors.some((e) => e.code === "FILE_QUOTA_EXCEEDED")) {
373+
throw new CliError("You have reached the total file size limit.", {cause: error});
374+
}
375+
throw error;
376+
}
367377
}
368378
}
369379

0 commit comments

Comments
 (0)