torch-mlir/projects/ltc/csrc/base_lazy_backend/utils/exception.h

33 lines
1.5 KiB
C
Raw Normal View History

//===- exception.h --------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Also available under a BSD-style license. See LICENSE.
//
//===----------------------------------------------------------------------===//
#pragma once
#include <exception>
#include <sstream>
#include <string>
2022-03-24 22:15:43 +08:00
#define UNIMPLEMENTED_ERROR(msg) \
{ \
std::ostringstream err; \
err << "Unimplemented Error: " << msg; \
throw std::runtime_error(err.str()); \
}
2022-03-24 22:15:43 +08:00
#define UNIMPLEMENTED_FUNCTION_ERROR() \
UNIMPLEMENTED_ERROR("\n\t" << __FILE__ << ":" << __LINE__ << " " \
<< __PRETTY_FUNCTION__)
2022-03-24 22:15:43 +08:00
#define UNSUPPORTED_ERROR(msg) \
{ \
std::ostringstream err; \
err << "Unsupported Error: " << msg; \
throw std::runtime_error(err.str()); \
}