@prisma/client-engine-runtime 6.7.0-dev.3 → 6.7.0-integration-push-sunrovnkrkpv.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -486,6 +486,11 @@ var TransactionManagerError = class extends Error {
486
486
  }
487
487
  code = "P2028";
488
488
  };
489
+ var TransactionDriverAdapterError = class extends TransactionManagerError {
490
+ constructor(message, errorParams) {
491
+ super(`Error from Driver Adapter: ${message}`, { ...errorParams.driverAdapterError });
492
+ }
493
+ };
489
494
  var TransactionNotFoundError = class extends TransactionManagerError {
490
495
  constructor() {
491
496
  super(
@@ -503,7 +508,7 @@ var TransactionRolledBackError = class extends TransactionManagerError {
503
508
  super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`);
504
509
  }
505
510
  };
506
- var TransactionStartTimeoutError = class extends TransactionManagerError {
511
+ var TransactionStartTimoutError = class extends TransactionManagerError {
507
512
  constructor() {
508
513
  super("Unable to start a transaction in the given time.");
509
514
  }
@@ -556,7 +561,14 @@ var TransactionManager = class {
556
561
  };
557
562
  this.transactions.set(transaction.id, transaction);
558
563
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
559
- const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
564
+ let startedTransaction;
565
+ try {
566
+ startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
567
+ } catch (error) {
568
+ throw new TransactionDriverAdapterError("Failed to start transaction.", {
569
+ driverAdapterError: error
570
+ });
571
+ }
560
572
  switch (transaction.status) {
561
573
  case "waiting":
562
574
  transaction.transaction = startedTransaction;
@@ -566,7 +578,7 @@ var TransactionManager = class {
566
578
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
567
579
  return { id: transaction.id };
568
580
  case "timed_out":
569
- throw new TransactionStartTimeoutError();
581
+ throw new TransactionStartTimoutError();
570
582
  case "running":
571
583
  case "committed":
572
584
  case "rolled_back":
@@ -639,12 +651,24 @@ var TransactionManager = class {
639
651
  debug("Closing transaction.", { transactionId: tx.id, status });
640
652
  tx.status = status;
641
653
  if (tx.transaction && status === "committed") {
642
- await tx.transaction.commit();
654
+ try {
655
+ await tx.transaction.commit();
656
+ } catch (error) {
657
+ throw new TransactionDriverAdapterError("Failed to commit transaction.", {
658
+ driverAdapterError: error
659
+ });
660
+ }
643
661
  if (!tx.transaction.options.usePhantomQuery) {
644
662
  await tx.transaction.executeRaw(COMMIT_QUERY());
645
663
  }
646
664
  } else if (tx.transaction) {
647
- await tx.transaction.rollback();
665
+ try {
666
+ await tx.transaction.rollback();
667
+ } catch (error) {
668
+ throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
669
+ driverAdapterError: error
670
+ });
671
+ }
648
672
  if (!tx.transaction.options.usePhantomQuery) {
649
673
  await tx.transaction.executeRaw(ROLLBACK_QUERY());
650
674
  }
package/dist/index.mjs CHANGED
@@ -446,6 +446,11 @@ var TransactionManagerError = class extends Error {
446
446
  }
447
447
  code = "P2028";
448
448
  };
449
+ var TransactionDriverAdapterError = class extends TransactionManagerError {
450
+ constructor(message, errorParams) {
451
+ super(`Error from Driver Adapter: ${message}`, { ...errorParams.driverAdapterError });
452
+ }
453
+ };
449
454
  var TransactionNotFoundError = class extends TransactionManagerError {
450
455
  constructor() {
451
456
  super(
@@ -463,7 +468,7 @@ var TransactionRolledBackError = class extends TransactionManagerError {
463
468
  super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`);
464
469
  }
465
470
  };
466
- var TransactionStartTimeoutError = class extends TransactionManagerError {
471
+ var TransactionStartTimoutError = class extends TransactionManagerError {
467
472
  constructor() {
468
473
  super("Unable to start a transaction in the given time.");
469
474
  }
@@ -516,7 +521,14 @@ var TransactionManager = class {
516
521
  };
517
522
  this.transactions.set(transaction.id, transaction);
518
523
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
519
- const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
524
+ let startedTransaction;
525
+ try {
526
+ startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
527
+ } catch (error) {
528
+ throw new TransactionDriverAdapterError("Failed to start transaction.", {
529
+ driverAdapterError: error
530
+ });
531
+ }
520
532
  switch (transaction.status) {
521
533
  case "waiting":
522
534
  transaction.transaction = startedTransaction;
@@ -526,7 +538,7 @@ var TransactionManager = class {
526
538
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
527
539
  return { id: transaction.id };
528
540
  case "timed_out":
529
- throw new TransactionStartTimeoutError();
541
+ throw new TransactionStartTimoutError();
530
542
  case "running":
531
543
  case "committed":
532
544
  case "rolled_back":
@@ -599,12 +611,24 @@ var TransactionManager = class {
599
611
  debug("Closing transaction.", { transactionId: tx.id, status });
600
612
  tx.status = status;
601
613
  if (tx.transaction && status === "committed") {
602
- await tx.transaction.commit();
614
+ try {
615
+ await tx.transaction.commit();
616
+ } catch (error) {
617
+ throw new TransactionDriverAdapterError("Failed to commit transaction.", {
618
+ driverAdapterError: error
619
+ });
620
+ }
603
621
  if (!tx.transaction.options.usePhantomQuery) {
604
622
  await tx.transaction.executeRaw(COMMIT_QUERY());
605
623
  }
606
624
  } else if (tx.transaction) {
607
- await tx.transaction.rollback();
625
+ try {
626
+ await tx.transaction.rollback();
627
+ } catch (error) {
628
+ throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
629
+ driverAdapterError: error
630
+ });
631
+ }
608
632
  if (!tx.transaction.options.usePhantomQuery) {
609
633
  await tx.transaction.executeRaw(ROLLBACK_QUERY());
610
634
  }
@@ -1,8 +1,14 @@
1
+ import { Error as DriverAdapterError } from '@prisma/driver-adapter-utils';
1
2
  export declare class TransactionManagerError extends Error {
2
3
  meta?: Record<string, unknown> | undefined;
3
4
  code: string;
4
5
  constructor(message: string, meta?: Record<string, unknown> | undefined);
5
6
  }
7
+ export declare class TransactionDriverAdapterError extends TransactionManagerError {
8
+ constructor(message: string, errorParams: {
9
+ driverAdapterError: DriverAdapterError;
10
+ });
11
+ }
6
12
  export declare class TransactionNotFoundError extends TransactionManagerError {
7
13
  constructor();
8
14
  }
@@ -12,7 +18,7 @@ export declare class TransactionClosedError extends TransactionManagerError {
12
18
  export declare class TransactionRolledBackError extends TransactionManagerError {
13
19
  constructor(operation: string);
14
20
  }
15
- export declare class TransactionStartTimeoutError extends TransactionManagerError {
21
+ export declare class TransactionStartTimoutError extends TransactionManagerError {
16
22
  constructor();
17
23
  }
18
24
  export declare class TransactionExecutionTimeoutError extends TransactionManagerError {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.7.0-dev.3",
3
+ "version": "6.7.0-integration-push-sunrovnkrkpv.1",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,8 +29,8 @@
29
29
  "nanoid": "5.1.5",
30
30
  "ulid": "3.0.0",
31
31
  "uuid": "11.1.0",
32
- "@prisma/driver-adapter-utils": "6.7.0-dev.3",
33
- "@prisma/debug": "6.7.0-dev.3"
32
+ "@prisma/debug": "6.7.0-integration-push-sunrovnkrkpv.1",
33
+ "@prisma/driver-adapter-utils": "6.7.0-integration-push-sunrovnkrkpv.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/jest": "29.5.14",