talm
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5// Package ctxutil provides utilities for working with contexts.
6package ctxutil7
8import "context"9
10// Cause returns the cause of the context error, or nil if there is no error or the error is a usual context error.
11func Cause(ctx context.Context) error {12if c := context.Cause(ctx); c != ctx.Err() {13return c14}15
16return nil17}
18