27#ifndef FCML_ERRORS_HPP_
28#define FCML_ERRORS_HPP_
166 return static_cast<fcml_usize
>( _errorInfos.size() );
177 checkVectorAccess( index );
178 return _errorInfos[index];
188 checkVectorAccess( index );
189 return _errorInfos[index];
198 _errorInfos.push_back(errorInfo);
200 case ErrorInfo::EL_ERROR:
203 case ErrorInfo::EL_WARN:
233 return _errorInfos.empty();
246 return _errorInfos[0];
259 return _errorInfos[0];
285 if( errorMessage.empty() ) {
288 return message +
FCML_TEXT(
": ") + errorMessage;
310 void checkVectorAccess( fcml_usize index )
const {
311 if( index >= _errorInfos.size() ) {
318 std::vector<ErrorInfo> _errorInfos;
358 BaseException( msg, error ), _errorContainer( errorContainer ) {
367 return _errorContainer;
376 _errorContainer = errorContainer;
Bad arguments.
Definition fcml_common.hpp:242
Base exception for all exceptions exposed by FCML library.
Definition fcml_common.hpp:187
Base class for all exceptions that are aware of ErrorContainer.
Definition fcml_errors.hpp:347
const ErrorContainer & getErrorContainer() const
Gets a reference to an error container associated with the exception.
Definition fcml_errors.hpp:366
ErrorContainerAwareException(const fcml_cstring &msg, const ErrorContainer &errorContainer, fcml_ceh_error error=FCML_CEH_GEC_NO_ERROR)
Creates an error container aware exception instance and sets basic information for it.
Definition fcml_errors.hpp:357
void setErrorContainer(const ErrorContainer &errorContainer)
Sets a new error container for the exception.
Definition fcml_errors.hpp:375
Wraps multiple errors into one component.
Definition fcml_errors.hpp:148
ErrorInfo & getFirstError()
Returns the first error from the container.
Definition fcml_errors.hpp:255
void addErrorInfo(const ErrorInfo &errorInfo)
Adds a new error into the container.
Definition fcml_errors.hpp:197
fcml_usize getSize() const
Gets number of errors in the container.
Definition fcml_errors.hpp:165
bool isEmpty() const
Gets true if there is any error or warning in the container.
Definition fcml_errors.hpp:232
ErrorContainer()
Default constructor.
Definition fcml_errors.hpp:155
ErrorInfo & operator[](fcml_usize index)
Gets an error at given index.
Definition fcml_errors.hpp:187
fcml_cstring prepareErrorMessage(const fcml_cstring &message) const
Prepares an error message basing on the first error in the container.
Definition fcml_errors.hpp:283
void clean()
Cleans all errors and warnings.
Definition fcml_errors.hpp:296
const ErrorInfo & operator[](fcml_usize index) const
Gets an error at given index.
Definition fcml_errors.hpp:176
fcml_cstring getFirstErrorMessage() const
Returns the first error message from the container.
Definition fcml_errors.hpp:267
bool isWarn() const
Returns true if there is any warning in the container.
Definition fcml_errors.hpp:223
const ErrorInfo & getFirstError() const
Returns the first error from the container.
Definition fcml_errors.hpp:242
bool isError() const
Returns true if there is any error in the container.
Definition fcml_errors.hpp:214
Contains an error message together with error level and error code.
Definition fcml_errors.hpp:42
void setMessage(const fcml_cstring &message)
Sets error message.
Definition fcml_errors.hpp:129
void setCode(fcml_ceh_error code)
Sets a new error code.
Definition fcml_errors.hpp:93
ErrorLevel getLevel() const
Gets error level.
Definition fcml_errors.hpp:102
void setLevel(ErrorLevel level)
Sets error level.
Definition fcml_errors.hpp:111
ErrorLevel
Error level.
Definition fcml_errors.hpp:48
const fcml_cstring & getMessage() const
Gets error message.
Definition fcml_errors.hpp:120
ErrorInfo()
Default constructor.
Definition fcml_errors.hpp:59
ErrorInfo(const fcml_cstring &message, fcml_ceh_error code=FCML_CEH_GEC_NO_ERROR, ErrorLevel level=EL_ERROR)
Creates an error for given message and optional error code and level.
Definition fcml_errors.hpp:71
fcml_ceh_error getCode() const
Gets error code.
Definition fcml_errors.hpp:84
Types converter.
Definition fcml_errors.hpp:329
Illegal state exception.
Definition fcml_common.hpp:253
C++ wrappers common classes.
std::basic_string< fcml_char > fcml_cstring
By using this type definition here, it will be definitely much easier to support UNICODE in future re...
Definition fcml_common.hpp:53
Global error handling related declarations.
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition fcml_errors.h:156
@ FCML_EN_CEH_EL_ERROR
Errors are reported when something more important happened and processing should be stopped.
Definition fcml_errors.h:164
#define FCML_TEXT(x)
Used to code literal strings.
Definition fcml_types.h:61
@ FCML_CEH_GEC_NO_ERROR
Operation succeed.
Definition fcml_errors.h:42
Container for all collected errors and warnings.
Definition fcml_errors.h:180
fcml_st_ceh_error_info * errors
All errors and warnings going here.
Definition fcml_errors.h:182
Information about one particular error/warning.
Definition fcml_errors.h:168
struct fcml_st_ceh_error_info * next_error
Next error/warning on the list.
Definition fcml_errors.h:170
fcml_en_ceh_error_level level
Error level.
Definition fcml_errors.h:176
fcml_ceh_error code
Error code.
Definition fcml_errors.h:174
fcml_string message
Error message.
Definition fcml_errors.h:172