\doxysection{gko::\+Error Class Reference}
\hypertarget{classgko_1_1Error}{}\label{classgko_1_1Error}\index{gko::Error@{gko::Error}}


The \doxylink{classgko_1_1Error}{Error} class is used to report exceptional behaviour in library functions.  




{\ttfamily \+\#include $<$ginkgo/\+core/\+base/\+exception.\+hpp$>$}



Inheritance diagram for gko::\+Error:\+
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{classgko_1_1Error__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for gko::\+Error:\+
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=157pt]{classgko_1_1Error__coll__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\doxymbox{\hyperlink{classgko_1_1Error_a750493241a840d96cafbf9c84cfd4f52}{Error}} (const std::\+string \&file, int line, const std::\+string \&\doxymbox{\hyperlink{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}{what}})
\begin{DoxyCompactList}\small\item\em Initializes an error. \end{DoxyCompactList}\item 
\Hypertarget{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}\label{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0} 
virtual const char \texorpdfstring{$\ast$}{*} {\bfseries what} () const noexcept override
\begin{DoxyCompactList}\small\item\em Returns a human-\/readable string with a more detailed description of the error. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The \doxylink{classgko_1_1Error}{Error} class is used to report exceptional behaviour in library functions. 

Ginkgo uses C++ exception mechanism to this end, and the \doxylink{classgko_1_1Error}{Error} class represents a base class for all types of errors. The exact list of errors which could occur during the execution of a certain library routine is provided in the documentation of that routine, along with a short description of the situation when that error can occur. During runtime, these errors can be detected by using standard C++ try-\/catch blocks, and a human-\/readable error description can be obtained by calling the \doxylink{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}{Error::\+what()} method.

As an example, trying to compute a matrix-\/vector product with arguments of incompatible size will result in a \doxylink{classgko_1_1DimensionMismatch}{Dimension\+Mismatch} error, which is demonstrated in the following program.


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <ginkgo.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{using\ namespace\ }gko;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main()}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \textcolor{keyword}{auto}\ omp\ =\ create<OmpExecutor>();}
\DoxyCodeLine{\ \ \ \ \textcolor{keyword}{auto}\ A\ =\ randn\_fill<matrix::Csr<float>>(5,\ 5,\ 0f,\ 1f,\ omp);}
\DoxyCodeLine{\ \ \ \ \textcolor{keyword}{auto}\ x\ =\ fill<matrix::Dense<float>>(6,\ 1,\ 1f,\ omp);}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{try}\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ y\ =\ apply(A,\ x);}
\DoxyCodeLine{\ \ \ \ \}\ \textcolor{keywordflow}{catch}(\doxymbox{\hyperlink{classgko_1_1Error_a750493241a840d96cafbf9c84cfd4f52}{Error}}\ e)\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{//\ an\ error\ occurred,\ write\ the\ message\ to\ screen\ and\ exit}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ std::cout\ <<\ e.\doxymbox{\hyperlink{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}{what}}()\ <<\ std::endl;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCode}
 

\label{doc-constructors}
\Hypertarget{classgko_1_1Error_doc-constructors}
\doxysubsection{Constructor \& Destructor Documentation}
\Hypertarget{classgko_1_1Error_a750493241a840d96cafbf9c84cfd4f52}\index{gko::Error@{gko::Error}!Error@{Error}}
\index{Error@{Error}!gko::Error@{gko::Error}}
\doxysubsubsection{\texorpdfstring{Error()}{Error()}}
{\footnotesize\ttfamily \label{classgko_1_1Error_a750493241a840d96cafbf9c84cfd4f52} 
gko::\+\+Error::\+\+Error (\begin{DoxyParamCaption}\item[{const std::\+string \&}]{file}{, }\item[{int}]{line}{, }\item[{const std::\+string \&}]{what}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Initializes an error. 


\begin{DoxyParams}{Parameters}
{\em file} & The name of the offending source file \\
\hline
{\em line} & The source code line number where the error occurred \\
\hline
{\em \doxylink{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}{what}} & The error message \\
\hline
\end{DoxyParams}


References \doxymbox{\hyperlink{classgko_1_1Error_aec78ba67d5d7bf123d20afbe086977d0}{what()}}.



Referenced by \doxymbox{\hyperlink{classgko_1_1AllocationError_ab06f1e22cd0cd39acab7cd5e96f2f9ca}{gko::\+\+Allocation\+Error::\+\+Allocation\+Error()}}, \doxymbox{\hyperlink{classgko_1_1BadDimension_a774454482004beac61bd983f74f446c3}{gko::\+\+Bad\+Dimension::\+\+Bad\+Dimension()}}, \doxymbox{\hyperlink{classgko_1_1BlockSizeError_a861999cfafdd726814ef4bcd06734bd7}{gko::\+\+Block\+Size\+Error$<$ Index\+Type $>$::\+\+Block\+Size\+Error()}}, \doxymbox{\hyperlink{classgko_1_1CublasError_a4f16cd8a9189da444d11a97337a56d8f}{gko::\+\+Cublas\+Error::\+\+Cublas\+Error()}}, \doxymbox{\hyperlink{classgko_1_1CudaError_aa4f4d466d2ccdb9da5e331d8dad92d39}{gko::\+\+Cuda\+Error::\+\+Cuda\+Error()}}, \doxymbox{\hyperlink{classgko_1_1CufftError_a8a11ecdb73626e04ee2dfb08179a5f60}{gko::\+\+Cufft\+Error::\+\+Cufft\+Error()}}, \doxymbox{\hyperlink{classgko_1_1CurandError_ab93a52996f5eef8b9a6b9668680cf846}{gko::\+\+Curand\+Error::\+\+Curand\+Error()}}, \doxymbox{\hyperlink{classgko_1_1CusparseError_ad51ca5caecfc2e41bd06c779d2ca57ae}{gko::\+\+Cusparse\+Error::\+\+Cusparse\+Error()}}, \doxymbox{\hyperlink{classgko_1_1DimensionMismatch_ae9ece719cbd41a39835655ba3e70aa47}{gko::\+\+Dimension\+Mismatch::\+\+Dimension\+Mismatch()}}, \doxymbox{\hyperlink{classgko_1_1HipblasError_a36e990d2fbc18109ede0991eada7833b}{gko::\+\+Hipblas\+Error::\+\+Hipblas\+Error()}}, \doxymbox{\hyperlink{classgko_1_1HipError_a73cd6dad80b89baeabebd9f907a99927}{gko::\+\+Hip\+Error::\+\+Hip\+Error()}}, \doxymbox{\hyperlink{classgko_1_1HipfftError_af0f3f804962813a664b9ce668f060213}{gko::\+\+Hipfft\+Error::\+\+Hipfft\+Error()}}, \doxymbox{\hyperlink{classgko_1_1HiprandError_af7ee80114b42216f1c0a61a0bd5c9058}{gko::\+\+Hiprand\+Error::\+\+Hiprand\+Error()}}, \doxymbox{\hyperlink{classgko_1_1HipsparseError_a703714b07299638208a85e5a6d3238e8}{gko::\+\+Hipsparse\+Error::\+\+Hipsparse\+Error()}}, \doxymbox{\hyperlink{classgko_1_1InvalidStateError_ae8fe5d221c42537769955d596e833516}{gko::\+\+Invalid\+State\+Error::\+\+Invalid\+State\+Error()}}, \doxymbox{\hyperlink{classgko_1_1KernelNotFound_ae75eb6d7620b86c81cafeee9c38ffc47}{gko::\+\+Kernel\+Not\+Found::\+\+Kernel\+Not\+Found()}}, \doxymbox{\hyperlink{classgko_1_1MetisError_a1cb1e1a27d3c3d313496fa16cb10b6f5}{gko::\+\+Metis\+Error::\+\+Metis\+Error()}}, \doxymbox{\hyperlink{classgko_1_1MpiError_a594fdc81da9e7051bae255853b682a9c}{gko::\+\+Mpi\+Error::\+\+Mpi\+Error()}}, \doxymbox{\hyperlink{classgko_1_1NotCompiled_aa85feba061f17a192a47f238a5bb4a32}{gko::\+\+Not\+Compiled::\+\+Not\+Compiled()}}, \doxymbox{\hyperlink{classgko_1_1NotImplemented_a29f0b78ee5e0c2f71ddf38487a1fe5c2}{gko::\+\+Not\+Implemented::\+\+Not\+Implemented()}}, \doxymbox{\hyperlink{classgko_1_1NotSupported_ae4d84be2a2a769e0877c4aeb75e44794}{gko::\+\+Not\+Supported::\+\+Not\+Supported()}}, \doxymbox{\hyperlink{classgko_1_1OutOfBoundsError_a21254b6802ba852e3f9f44744ad63faf}{gko::\+\+Out\+Of\+Bounds\+Error::\+\+Out\+Of\+Bounds\+Error()}}, \doxymbox{\hyperlink{classgko_1_1OverflowError_a68537483586cbde075e3353f2c73ddba}{gko::\+\+Overflow\+Error::\+\+Overflow\+Error()}}, \doxymbox{\hyperlink{classgko_1_1StreamError_a511af28ae0b5a98998ef96f21cf1863e}{gko::\+\+Stream\+Error::\+\+Stream\+Error()}}, \doxymbox{\hyperlink{classgko_1_1UnsupportedMatrixProperty_a38d858283d1e7e4a852c93baf79e7217}{gko::\+\+Unsupported\+Matrix\+Property::\+\+Unsupported\+Matrix\+Property()}}, and \doxymbox{\hyperlink{classgko_1_1ValueMismatch_a505714cad59257a24aa712a8d3449e4a}{gko::\+\+Value\+Mismatch::\+\+Value\+Mismatch()}}.



The documentation for this class was generated from the following file:\+\begin{DoxyCompactItemize}
\item 
ginkgo/\+core/\+base/\+exception.\+hpp\end{DoxyCompactItemize}
