Buckets

ICBucket

ICPay Cloud guide

On-chain encrypted file storage

New bucketPricingGitLab
HomeIntroductionQuick StartInstallationConfigurationAuthenticationBasic UsageBest PracticesAPI OverviewAPI EndpointsAPI RequestsAPI ResponsesError CodesError HandlingTroubleshootingLocal DevelopmentProduction DeploymentConfiguration ReferenceTypes ReferenceChangelogFrequently Asked Questions
ICBucket

On-chain encrypted file storage

Overview

IntroductionQuick StartInstallation

Guides

ConfigurationAuthenticationBasic UsageBest Practices

API Reference

API OverviewAPI EndpointsAPI RequestsAPI Responses

Errors

Error CodesError HandlingTroubleshooting

Deployment

Local DevelopmentProduction Deployment

Reference

Configuration ReferenceTypes ReferenceChangelog

FAQ

Frequently Asked Questions
ICPay

© 2026 ICPay. All rights reserved.

contact@icpay.cloud

Products

  • ICFalcon
  • ICBucket
  • Canisters
  • Top up cycles
  • ICPay Wallet

Explore

  • Channels
  • Blog

Resources

  • Falcon CLI
  • ICP-Hub Packages
  • ICBucket Docs
  • Blog

Company

  • Charity
  • About
  • FAQ
  • Roadmap

Legal

  • Brands
  • Terms
  • Privacy
  • Transparency

Community

  • GitLab
  • X
  • LinkedIn
  • Discord
  • Support
ICPayICPay
  • Blog
Buckets

ICBucket

ICPay Cloud guide

On-chain encrypted file storage

New bucketPricingGitLab
HomeIntroductionQuick StartInstallationConfigurationAuthenticationBasic UsageBest PracticesAPI OverviewAPI EndpointsAPI RequestsAPI ResponsesError CodesError HandlingTroubleshootingLocal DevelopmentProduction DeploymentConfiguration ReferenceTypes ReferenceChangelogFrequently Asked Questions
ICBucket

On-chain encrypted file storage

Overview

IntroductionQuick StartInstallation

Guides

ConfigurationAuthenticationBasic UsageBest Practices

API Reference

API OverviewAPI EndpointsAPI RequestsAPI Responses

Errors

Error CodesError HandlingTroubleshooting

Deployment

Local DevelopmentProduction Deployment

Reference

Configuration ReferenceTypes ReferenceChangelog

FAQ

Frequently Asked Questions

Errors

Error Handling

Implement resilient client-side retry strategies, exponential backoff, and exception catching.

Error Handling

Build production-grade applications with resilient network retry handling and typed error catching.

Prerequisites

  • Client configured with error interception.

Steps

1. Typed Exception Catching

The TypeScript SDK provides typed errors for granular recovery:

import { ICBucket, BucketError } from "icpay-bucket"

const bucket = new ICBucket({
  bucketId: "my-assets",
  apiKey: process.env.ICBUCKET_API_KEY!,
})

try {
  await bucket.uploadFile("document.pdf", buffer)
} catch (error) {
  if (error instanceof BucketError) {
    switch (error.code) {
      case "ERR_PAYLOAD_TOO_LARGE":
        console.warn("File is too large for single-call upload, switching to chunked upload...")
        await bucket.uploadLargeFile("document.pdf", buffer)
        break
      case "ERR_QUOTA_EXCEEDED":
        console.error("Storage limit reached! Please upgrade your tier.")
        break
      default:
        console.error(`Bucket error [${error.code}]:`, error.message)
    }
  } else {
    console.error("Unexpected error:", error)
  }
}

2. Exponential Backoff Pattern

When handling transient network fluctuations or canister busy states:

async function uploadWithRetry(fn: () => Promise<any>, maxAttempts = 3) {
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
    try {
      return await fn()
    } catch (err: any) {
      if (attempt === maxAttempts || !err.isRetryable) throw err
      const delay = Math.pow(2, attempt) * 500
      await new Promise((resolve) => setTimeout(resolve, delay))
    }
  }
}

Related Pages

  • Error Codes
  • Troubleshooting
  • Configuration Reference
PreviousError CodesNextTroubleshooting

On this page

PrerequisitesSteps1. Typed Exception Catching2. Exponential Backoff PatternRelated Pages
HomeIntroductionQuick StartInstallationConfigurationAuthenticationBasic UsageBest PracticesAPI OverviewAPI EndpointsAPI RequestsAPI ResponsesError CodesError HandlingTroubleshootingLocal DevelopmentProduction DeploymentConfiguration ReferenceTypes ReferenceChangelogFrequently Asked Questions
HomeIntroductionQuick StartInstallationConfigurationAuthenticationBasic UsageBest PracticesAPI OverviewAPI EndpointsAPI RequestsAPI ResponsesError CodesError HandlingTroubleshootingLocal DevelopmentProduction DeploymentConfiguration ReferenceTypes ReferenceChangelogFrequently Asked Questions
ICBucket

On-chain encrypted file storage

Overview

IntroductionQuick StartInstallation

Guides

ConfigurationAuthenticationBasic UsageBest Practices

API Reference

API OverviewAPI EndpointsAPI RequestsAPI Responses

Errors

Error CodesError HandlingTroubleshooting

Deployment

Local DevelopmentProduction Deployment

Reference

Configuration ReferenceTypes ReferenceChangelog

FAQ

Frequently Asked Questions