2016-12-28 22:52:27 +03:00
|
|
|
//===- exception.h ----------------------------------------------*- C++ -*-===//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// //
|
|
|
|
// exception.h //
|
|
|
|
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
2017-01-28 03:48:08 +03:00
|
|
|
// This file is distributed under the University of Illinois Open Source //
|
|
|
|
// License. See LICENSE.TXT for details. //
|
2016-12-28 22:52:27 +03:00
|
|
|
// //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dxc/Support/ErrorCodes.h"
|
2018-06-17 18:31:21 +03:00
|
|
|
#include "dxc/Support/WinAdapter.h"
|
2016-12-28 22:52:27 +03:00
|
|
|
#include <exception>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace hlsl
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Exception stores off information about an error and its error message for
|
|
|
|
/// later consumption by the hlsl compiler tools.
|
|
|
|
/// </summary>
|
|
|
|
struct Exception : public std::exception
|
|
|
|
{
|
|
|
|
/// <summary>HRESULT error code. Must be a failure.</summary>
|
|
|
|
HRESULT hr;
|
|
|
|
std::string msg;
|
|
|
|
|
|
|
|
Exception(HRESULT errCode) : hr(errCode) { }
|
|
|
|
Exception(HRESULT errCode, const std::string &errMsg) : hr(errCode), msg(errMsg) { }
|
|
|
|
|
|
|
|
// what returns a formatted message with the error code and the message used
|
|
|
|
// to create the message.
|
|
|
|
virtual const char *what() const throw() { return msg.c_str(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace hlsl
|