Skip to content

Commit 42cea39

Browse files
committed
Enhance readme with improved error handling and usage examples
1 parent 1409fb4 commit 42cea39

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ yarn add poodle-js
2525
## Quick Start
2626

2727
```typescript
28-
import { PoodleClient } from 'poodle-js';
28+
import { PoodleClient, PoodleError } from 'poodle-js';
2929

3030
// Initialize the client with your API key
3131
const client = new PoodleClient({
32-
apiKey: 'your-api-key-here',
32+
apiKey: 'YOUR_POODLE_API_KEY_HERE',
3333
});
3434

3535
// Send an email
@@ -40,16 +40,24 @@ async function sendEmail() {
4040
4141
subject: 'Hello from Poodle!',
4242
html: '<h1>Hello!</h1><p>This is a test email.</p>',
43-
text: 'Hello! This is a test email.',
4443
});
4544

4645
console.log('Email API call successful:', response.message);
4746
} catch (error) {
48-
console.error('Failed to send email:', error);
47+
console.error('Failed to send email:', error.message);
48+
49+
if (error instanceof PoodleError) {
50+
console.error('Status Code:', error.statusCode);
51+
console.error('Details:', error.details);
52+
}
4953
}
5054
}
55+
56+
sendEmail();
5157
```
5258

59+
For more usage patterns, including sending text-only emails, see the [examples](./examples) directory.
60+
5361
## Features
5462

5563
- Simple and intuitive API

0 commit comments

Comments
 (0)