tbr_errors

package
v0.0.0-...-7e6bd6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

bronger/tools – Go tools of Torsten Bronger

Copyright (C) 2023 Torsten Bronger, bronger@physik.rwth-aachen.de

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitOnExpectedError

func ExitOnExpectedError(e error, msg string, exitCode int, args ...any)

ExitOnExpectedError aborts the program in case of an expected error, if a non-nil error value is passed. See the README for a detailed explanation of “expected error”. It is supposed to be called in the main package, where we know that we must abort. Use Handle to properly handle the panic in the main function. It must not be called in a goroutine, as Handle will be effectless then.

func ExitWithExpectedError

func ExitWithExpectedError(msg string, exitCode int, args ...any)

ExitWithExpectedError aborts the program in case of an expected error. See the README for a detailed explanation. It is supposed to be called in the main package, where we know that we must abort. Use Handle to properly handle the panic in the main function. It must not be called in a goroutine, as Handle will be effectless then.

func Handle

func Handle(e_ any)

Handle converts a panic from ExitOnExpectedError and ExitWithExpectedError into a termination of the program with the proper exit code. Place `defer func() { tbr_errors.Handle(recover()) }()` at the very top of your main function.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL