Synthome Docs
Guides

Error Handling

Handle errors gracefully and implement retry strategies

Error Handling

Learn how to handle errors in Synthome pipelines, implement retry logic, and build resilient applications.

Error Types

Synthome errors fall into these categories:

Error TypeDescriptionRetryable
ValidationInvalid parameters, missing fieldsNo
AuthenticationInvalid API keyNo
Rate LimitToo many requestsYes (with backoff)
ProviderModel provider failureYes
TimeoutOperation took too longYes
NetworkConnection issuesYes

Basic Error Handling

Wrap pipeline execution in try/catch:

import { compose, generateVideo, videoModel } from "@synthome/sdk";

try {
  const execution = await compose(
    generateVideo({
      model: videoModel("bytedance/seedance-1-pro", "replicate"),
      prompt: "A cinematic scene",
    }),
  ).execute();

  console.log("Video URL:", execution.result?.url);
} catch (error) {
  console.error("Pipeline failed:", error.message);
}

Using Callbacks

Use onError callback for non-blocking error handling:

const pipeline = compose(
  generateVideo({
    model: videoModel("bytedance/seedance-1-pro", "replicate"),
    prompt: "A cinematic scene",
  }),
);

pipeline.onError((error) => {
  console.error("Pipeline error:", error.message);
  // Log to monitoring service
  logToSentry(error);
});

const execution = await pipeline.execute({
  webhook: "https://your-server.com/webhook",
});

Next Steps

How is this guide?