about summary refs log blame commit diff
path: root/third_party/nix/src/libutil/status.hh
blob: aeee0f502257cfee99735e00a03992f6985d539c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                            
#pragma once

#include <absl/status/status.h>
#include <absl/strings/str_format.h>
#include <absl/strings/string_view.h>

#include "libutil/types.hh"

namespace nix::util {

inline void OkOrThrow(absl::Status status) {
  if (!status.ok()) {
    throw Error(absl::StrFormat("Operation failed: %s", status.ToString()));
  }
}

}  // namespace nix::util