Skip to content

File ManagedException.h

File List > SpinnakerNET > ManagedException.h

Go to the documentation of this file

//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR)
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================

#ifndef PGR_SPINNAKER_MANAGED_EXCEPTION_H
#define PGR_SPINNAKER_MANAGED_EXCEPTION_H

#include "Exception.h"

using namespace ::System;

namespace SpinnakerNET
{
    public ref class SpinnakerException : public ::System::Exception
    {
        public:
            SpinnakerException()
            {
                m_errorCode = Error::SPINNAKER_ERR_ERROR;
            }

            SpinnakerException(String^ message)
                : Exception(message)
            {
                m_errorCode = Error::SPINNAKER_ERR_ERROR;
            }

            SpinnakerException(String^ message, SpinnakerNET::Error error)
                : Exception(message), m_errorCode(error)
            {
            }

            SpinnakerException(String^ message, Exception^ inner)
                : Exception(message, inner)
            {
                m_errorCode = Error::SPINNAKER_ERR_ERROR;
            }

            SpinnakerException(Spinnaker::Exception& e);

            property String^ NativeErrorTrace
            {
                String^ get()
                {
                    String^ errorTrace = "Error Trace:" + Environment::NewLine + "Source: " + FormatErrorInfo();
                    return errorTrace;
                }
            }

            property Error ErrorCode
            {
                Error get()
                {
                    return m_errorCode;
                }
            }

        private:
            ::System::String^ FormatErrorInfo();
            Error m_errorCode;
    };
}

#endif // PGR_SPINNAKER_MANAGED_EXCEPTION_H