# Error Handling

```typescript
try {
  const mediaId = await instagram.postImage(url, caption);
  console.log('Posted successfully:', mediaId);
} catch (error) {
  console.error('Failed to post:', error.message);
  // Handle error appropriately
}
```