Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Member group

WithContext

Declaring type: ErrorExtensions
Module: System
Assembly: System.Runtime.dll

Overloads / Variants

WithContext

func WithContext<E>(message: string, captureStackTrace: bool) -> ContextError<E> where E: Error

Extension from ErrorExtensions.WithContext

Adds context, optionally capturing once at this boundary when no cause trace exists.

Parameters

Name Type Description
self E
message String
captureStackTrace Boolean

Return value

ContextError<E>

WithContext

func WithContext<E>(message: string) -> ContextError<E> where E: Error

Extension from ErrorExtensions.WithContext

Adds context using the application capture setting (disabled by default).

Parameters

Name Type Description
self E
message String

Return value

ContextError<E>