@ddd-ts-kit/sentry 0.82.0 → 0.83.2

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.
Files changed (3) hide show
  1. package/README.fr.md +14 -6
  2. package/README.md +13 -5
  3. package/package.json +6 -6
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:281de46cd74226d4 -->
2
+ <!-- translation-of: README.md sha256:4e0553c362a45a3d -->
3
3
 
4
4
  # @ddd-ts-kit/sentry
5
5
 
@@ -175,7 +175,7 @@ capture qui l'entoure la remonte.
175
175
 
176
176
  <!-- checked sample -->
177
177
  ```ts
178
- import { ConceptError, type ErrorReporter } from '@ddd-ts-kit/kernel';
178
+ import { DomainRefusal, type ErrorReporter } from '@ddd-ts-kit/kernel';
179
179
 
180
180
  interface PaymentGateway {
181
181
  capture(paymentId: string): Promise<'captured' | 'declined'>;
@@ -185,9 +185,17 @@ interface CapturePaymentCommand {
185
185
  readonly paymentId: string;
186
186
  }
187
187
 
188
- export class PaymentError extends ConceptError {
189
- static declined(paymentId: string) {
190
- return PaymentError.refusal('PAYMENT_DECLINED', `Payment ${paymentId} was declined.`, { paymentId });
188
+ // domain/errors/codes.ts
189
+ export const PaymentsCodes = {
190
+ PaymentDeclined: 'PAYMENT_DECLINED',
191
+ } as const;
192
+
193
+ // domain/errors/payment-declined.error.ts
194
+ export class PaymentDeclined extends DomainRefusal {
195
+ readonly code = PaymentsCodes.PaymentDeclined;
196
+
197
+ static forPayment(paymentId: string) {
198
+ return PaymentDeclined.refusal(`Payment ${paymentId} was declined.`, { paymentId });
191
199
  }
192
200
  }
193
201
 
@@ -214,7 +222,7 @@ export class CapturePaymentHandler {
214
222
 
215
223
  async execute(command: CapturePaymentCommand): Promise<void> {
216
224
  if ((await this.gateway.capture(command.paymentId)) === 'declined') {
217
- throw PaymentError.declined(command.paymentId);
225
+ throw PaymentDeclined.forPayment(command.paymentId);
218
226
  }
219
227
  }
220
228
  }
package/README.md CHANGED
@@ -166,7 +166,7 @@ export const reports = reporter.reports;
166
166
 
167
167
  <!-- checked sample -->
168
168
  ```ts
169
- import { ConceptError, type ErrorReporter } from '@ddd-ts-kit/kernel';
169
+ import { DomainRefusal, type ErrorReporter } from '@ddd-ts-kit/kernel';
170
170
 
171
171
  interface PaymentGateway {
172
172
  capture(paymentId: string): Promise<'captured' | 'declined'>;
@@ -176,9 +176,17 @@ interface CapturePaymentCommand {
176
176
  readonly paymentId: string;
177
177
  }
178
178
 
179
- export class PaymentError extends ConceptError {
180
- static declined(paymentId: string) {
181
- return PaymentError.refusal('PAYMENT_DECLINED', `Payment ${paymentId} was declined.`, { paymentId });
179
+ // domain/errors/codes.ts
180
+ export const PaymentsCodes = {
181
+ PaymentDeclined: 'PAYMENT_DECLINED',
182
+ } as const;
183
+
184
+ // domain/errors/payment-declined.error.ts
185
+ export class PaymentDeclined extends DomainRefusal {
186
+ readonly code = PaymentsCodes.PaymentDeclined;
187
+
188
+ static forPayment(paymentId: string) {
189
+ return PaymentDeclined.refusal(`Payment ${paymentId} was declined.`, { paymentId });
182
190
  }
183
191
  }
184
192
 
@@ -205,7 +213,7 @@ export class CapturePaymentHandler {
205
213
 
206
214
  async execute(command: CapturePaymentCommand): Promise<void> {
207
215
  if ((await this.gateway.capture(command.paymentId)) === 'declined') {
208
- throw PaymentError.declined(command.paymentId);
216
+ throw PaymentDeclined.forPayment(command.paymentId);
209
217
  }
210
218
  }
211
219
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/sentry",
3
- "version": "0.82.0",
3
+ "version": "0.83.2",
4
4
  "description": "Error reporting to Sentry or GlitchTip behind the kernel ErrorReporter port: unexpected failures only, correlated with traces, scrubbed before sending.",
5
5
  "keywords": [
6
6
  "ddd",
@@ -37,15 +37,15 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@ddd-ts-kit/kernel": "0.82.0"
40
+ "@ddd-ts-kit/kernel": "0.83.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@ddd-ts-kit/di": "0.82.0",
44
- "@ddd-ts-kit/http": "0.82.0",
45
- "@ddd-ts-kit/tracing": "0.82.0",
43
+ "@ddd-ts-kit/di": "0.83.2",
44
+ "@ddd-ts-kit/http": "0.83.2",
45
+ "@ddd-ts-kit/tracing": "0.83.2",
46
46
  "@opentelemetry/api": "^1.9.1",
47
47
  "@opentelemetry/sdk-trace-base": "^2.0.0",
48
- "@sentry/node": "^11.6.0"
48
+ "@sentry/node": "^11.8.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@opentelemetry/api": "^1.9.0",