| 1 | // Copyright 2025 The Go MCP SDK Authors. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package util |
| 6 | |
| 7 | import ( |
| 8 | "fmt" |
| 9 | ) |
| 10 | |
| 11 | // Wrapf wraps *errp with the given formatted message if *errp is not nil. |
| 12 | func Wrapf(errp *error, format string, args ...any) { |
| 13 | if *errp != nil { |
| 14 | *errp = fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), *errp) |
| 15 | } |
| 16 | } |