1 #ifndef GALAXY_EXCEPTION_HELPER_H
2 #define GALAXY_EXCEPTION_HELPER_H
14 #define GALAXY_EXCEPTION_HELPER_ERROR_CLASS(Exception, ExceptionInterface, ErrorType) \
15 class Exception : public ExceptionInterface \
18 explicit Exception(const IError* exception) : message(exception->GetMsg()) {}\
19 virtual const char* GetName() const { return #ExceptionInterface; } \
20 virtual const char* GetMsg() const { return message.c_str(); } \
21 virtual api::IError::Type GetType() const { return ErrorType; } \
24 const std::string message; \
27 GALAXY_EXCEPTION_HELPER_ERROR_CLASS(UnauthorizedAccessError, IUnauthorizedAccessError, IError::UNAUTHORIZED_ACCESS);
28 GALAXY_EXCEPTION_HELPER_ERROR_CLASS(InvalidArgumentError, IInvalidArgumentError, IError::INVALID_ARGUMENT);
29 GALAXY_EXCEPTION_HELPER_ERROR_CLASS(InvalidStateError, IInvalidStateError, IError::INVALID_STATE);
30 GALAXY_EXCEPTION_HELPER_ERROR_CLASS(RuntimeError, IRuntimeError, IError::RUNTIME_ERROR);
34 inline void ThrowIfGalaxyError()
39 switch (error->GetType())
41 case IError::UNAUTHORIZED_ACCESS:
throw details::UnauthorizedAccessError(error);
42 case IError::INVALID_ARGUMENT:
throw details::InvalidArgumentError(error);
43 case IError::INVALID_STATE:
throw details::InvalidStateError(error);
44 default:
throw details::RuntimeError(error);
Contains classes representing exceptions.
GALAXY_DLL_EXPORT const IError *GALAXY_CALLTYPE GetError()
Retrieves error connected with the last API call on the local thread.