@@ -185,22 +185,20 @@ export class Try<
185185 }
186186
187187 /**
188- * Configure error types that should be thrown through without being wrapped
189- * AND without being reported to the configured Reporter (Sentry).
190- * When using `.report()`, errors matching these types are re-thrown as-is
191- * and `Reporter.report()` is NOT called for them. Breadcrumbs configured via
192- * `.breadcrumbs()` are still recorded.
188+ * Configure error types that should be thrown through without being wrapped.
189+ * When using `.report()`, errors matching these types will be re-thrown as-is
190+ * instead of being wrapped with the custom message.
193191 *
194192 * @param ignoreErrorTypes Array of error type names (error.name) to throw through
195193 *
196194 * @example
197195 * ```typescript
198- * // Configure to throw ValidationError and AuthError as-is (and skip Sentry)
196+ * // Configure to throw ValidationError and AuthError as-is
199197 * Try.throwThroughErrorTypes(['ValidationError', 'AuthError']);
200198 *
201- * // Now these errors won't be wrapped or sent to Sentry :
199+ * // Now these errors won't be wrapped:
202200 * await new Try(validateUser, userData)
203- * .report('User validation failed') // ValidationError throws as-is, no captureException
201+ * .report('User validation failed') // ValidationError will be thrown as-is
204202 * .unwrap();
205203 * ```
206204 */
@@ -489,18 +487,18 @@ export class Try<
489487 if ( isPromiseLike < TryResult < TReturn > > ( result ) ) {
490488 return result . then ( ( resolved ) => {
491489 if ( ! resolved . success ) {
492- const isThrowThrough = Try . ignoreErrorTypes . includes (
493- resolved . error . name ,
494- ) ;
495- const shouldCapture = this . config . message && ! isThrowThrough ;
490+ const shouldCapture = this . config . message ;
496491
497492 if ( shouldCapture ) {
498493 this . reportError ( resolved . error ) ;
499494 } else if ( this . config . breadcrumbConfig ) {
500495 this . addBreadcrumbsIfConfigured ( ) ;
501496 }
502497
503- if ( this . config . message && ! isThrowThrough ) {
498+ if (
499+ this . config . message &&
500+ ! Try . ignoreErrorTypes . includes ( resolved . error . name )
501+ ) {
504502 const wrappedError = Try . defaultReporter . createWrappedError (
505503 resolved . error ,
506504 this . config . message ,
@@ -515,16 +513,18 @@ export class Try<
515513 }
516514
517515 if ( ! result . success ) {
518- const isThrowThrough = Try . ignoreErrorTypes . includes ( result . error . name ) ;
519- const shouldCapture = this . config . message && ! isThrowThrough ;
516+ const shouldCapture = this . config . message ;
520517
521518 if ( shouldCapture ) {
522519 this . reportError ( result . error ) ;
523520 } else if ( this . config . breadcrumbConfig ) {
524521 this . addBreadcrumbsIfConfigured ( ) ;
525522 }
526523
527- if ( this . config . message && ! isThrowThrough ) {
524+ if (
525+ this . config . message &&
526+ ! Try . ignoreErrorTypes . includes ( result . error . name )
527+ ) {
528528 const wrappedError = Try . defaultReporter . createWrappedError (
529529 result . error ,
530530 this . config . message ,
0 commit comments