github.com/opentofu/opentofu@v1.7.1/internal/tfdiags/doc.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 // Package tfdiags is a utility package for representing errors and 7 // warnings in a manner that allows us to produce good messages for the 8 // user. 9 // 10 // "diag" is short for "diagnostics", and is meant as a general word for 11 // feedback to a user about potential or actual problems. 12 // 13 // A design goal for this package is for it to be able to provide rich 14 // messaging where possible but to also be pragmatic about dealing with 15 // generic errors produced by system components that _can't_ provide 16 // such rich messaging. As a consequence, the main types in this package -- 17 // Diagnostics and Diagnostic -- are designed so that they can be "smuggled" 18 // over an error channel and then be unpacked at the other end, so that 19 // error diagnostics (at least) can transit through APIs that are not 20 // aware of this package. 21 package tfdiags