From dbb56f2986eefd0ffb1350ab1ff0cb47ad5e7918 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 21 Jul 2021 21:27:07 +0300 Subject: Add --no-private-config option for pkg-build and --no-{host,build2}-config options for cfg-create --- bpkg/diagnostics.hxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'bpkg/diagnostics.hxx') diff --git a/bpkg/diagnostics.hxx b/bpkg/diagnostics.hxx index 925b080..04ede36 100644 --- a/bpkg/diagnostics.hxx +++ b/bpkg/diagnostics.hxx @@ -16,15 +16,27 @@ namespace bpkg { using butl::diag_record; - // Throw this exception to terminate the process. The handler should - // assume that the diagnostics has already been issued. + // Throw this exception to terminate the process potentially with a custom + // exit code. The handler should assume that suitable diagnostics has + // already been issued. // - class failed: public std::exception {}; + class failed: public std::exception + { + public: + uint16_t code; + + explicit + failed (uint16_t c = 1): code (c) {} + }; // As above but needs to be used for recoverable errors which are likely to // disappear on the command retry. // - class recoverable: public failed {}; + class recoverable: public failed + { + public: + recoverable (): failed (2) {} + }; // Print process commmand line. If the number of elements is specified // (or the second version is used), then it will print the piped multi- -- cgit v1.1