Skip to content

Commit

Permalink
Merge pull request #69 from daichitakahashi/catchTransactionException
Browse files Browse the repository at this point in the history
Catch transaction exception
  • Loading branch information
daichitakahashi authored Jan 29, 2025
2 parents 9ae9cc3 + e6aa786 commit 657f63b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
6 changes: 6 additions & 0 deletions cf-eventhub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# cf-eventhub

## 0.0.20

### Patch Changes

- d04e7e2: fix(cf-eventhub): catch and report error during transaction

## 0.0.19

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion cf-eventhub/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cf-eventhub",
"type": "module",
"version": "0.0.19",
"version": "0.0.20",
"keywords": [
"cloudflare"
],
Expand Down
6 changes: 2 additions & 4 deletions cf-eventhub/src/dev/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ export class DevRepository implements Repository {
let result: Result<T, "INTERNAL_SERVER_ERROR" | E>;
try {
result = await fn(tx);
} catch {}

// @ts-ignore
if (!result) {
} catch {
return err("INTERNAL_SERVER_ERROR" as const);
}

if (result.isOk()) {
this.events = tx.events;
this.dispatches = tx.dispatches;
Expand Down
4 changes: 3 additions & 1 deletion cf-eventhub/src/postgres/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class PgRepository implements Repository {
if (result.isOk()) return;
tx.rollback();
});
} catch {}
} catch (e) {
this.logger.error("error on enterTransactionalScope", { error: e });
}

// @ts-ignore
if (!result) {
Expand Down
7 changes: 7 additions & 0 deletions iac/pulumi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @cf-eventhub/pulumi

## 0.0.18

### Patch Changes

- Updated dependencies [d04e7e2]
- [email protected]

## 0.0.17

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions iac/pulumi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@cf-eventhub/pulumi",
"main": "src/index.ts",
"type": "commonjs",
"version": "0.0.17",
"version": "0.0.18",
"keywords": [
"pulumi",
"cloudflare"
Expand All @@ -17,7 +17,7 @@
"dependencies": {
"@pulumi/cloudflare": "^5.40.0",
"@pulumi/pulumi": "^3.113.0",
"cf-eventhub": "^0.0.19"
"cf-eventhub": "^0.0.20"
},
"tsup": {
"entry": [
Expand Down
2 changes: 1 addition & 1 deletion web-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"typed-htmx": "^0.3.1",
"typescript": "^5.6.2",
"wrangler": "^3.83.0",
"cf-eventhub": "^0.0.19"
"cf-eventhub": "^0.0.20"
},
"tsup": {
"entry": [
Expand Down

0 comments on commit 657f63b

Please sign in to comment.