Context Protocol Docs
Start building
  • PROTOCOL OVERVIEW
    • ✖️About Context Protocol
    • 👾Why Context Protocol?
      • Verified AI-Ready Domains (VARD)
      • Training AI with verified data
      • SaaS Solution
    • 🤖Technology behind Context
    • 📈$TEX Token
      • Multi-chain token
      • Token Utility
      • Governance
      • Allocation
    • 🧐Use Cases and Applications
      • 📢Telegram bot for updates
      • 🔵Basenames integration
      • 🌎dWeb: Descentralized Website
      • 📌Decentralized Link3
  • DEVELOPERS
    • 👨‍💻Why build on Context
    • 🏗️Typescript SDK
      • Initialization
      • Working with Domains
      • Managing Documents
      • Creating Templates
      • Assets
      • Error Handling
    • 📑Example Workflow
    • ✨Create your first Domain
  • COMMUNITY
    • 🪂Community Program
    • 🫂Social Media
  • RESOURCES
    • 🛟Support
    • 🖥️WebApp
Powered by GitBook
On this page

Was this helpful?

  1. DEVELOPERS
  2. Typescript SDK

Error Handling

When calling a function, you can check if an error occurred by checking the error property in the returned object:

const document = await ctx.document("document_path");
if(document.success === false){
  console.error(document.error.error); // Error message
  console.error(document.error.message); // Detailed error message
  console.error(document.error.statusCode); // HTTP status code
}
PreviousAssetsNextExample Workflow

Last updated 9 months ago

Was this helpful?

🏗️