Skip to content

Commit

Permalink
add error handling to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
theocod3s committed Apr 29, 2024
1 parent d2af767 commit ec614ab
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,33 @@ Here's how to configure the SDK:

```typescript
const genesiscloud = new GenesisCloudClient({
TOKEN: "your_api_token_here",
TOKEN: process.env.GENESISCLOUD_TOKEN,
});
```

## Examples

### Error handling

Error handling can be done using the try/catch with the async/await syntax. For example:

```typescript
const listImages = async () => {
try {
const { images } = await genesiscloud.images.listImages({});
return images;
} catch (error) {
// ... handle the error
}
};
```

### Managing Instances

Listing Instances:

```typescript
const instances = await genesiscloud.instances.listInstances({
const { instances } = await genesiscloud.instances.listInstances({
page: 1,
perPage: 100,
});
Expand Down

0 comments on commit ec614ab

Please sign in to comment.