NuriaProject Framework
0.1
The NuriaProject Framework
|
Container for exposing Twig errors to user code. More...
#include <templateerror.hpp>
Public Types | |
enum | Component { None = 0, Engine, Loader, Tokenizer, Parser, Compiler, Renderer } |
enum | Error { NoError = 0, TemplateNotFound = 100, UnknownToken = 200, SyntaxError = 300, BadEndblockName, NonConstantExpression = 400, EmptyTemplateName, NoParentBlock, InvalidRegularExpression, InvalidEscapeMode, NoProgram = 500, VariableNotSet } |
Public Member Functions | |
TemplateError (Component component=None, Error error=NoError, const QString &what=QString(), Template::Location location=Template::Location()) | |
TemplateError (const TemplateError &other) | |
TemplateError (TemplateError &&other) | |
~TemplateError () | |
Component | component () const |
QString | componentName () const |
Error | error () const |
QString | errorName () const |
bool | hasFailed () const |
Template::Location | location () const |
TemplateError & | operator= (const TemplateError &other) |
TemplateError & | operator= (TemplateError &&other) |
QString | what () const |
Static Public Member Functions | |
static QString | componentName (Component component) |
static QString | errorName (Error error) |
Container for exposing Twig errors to user code.
This class is used to indicate errors when processing Twig code through various stages. It's essentially like a exception.
You can query the component, in which the error occured in, and the corresponding error code using the getters. For easier debugging, you can directly log instances of this class to QDebug and Nuria::Debug.
List of components to indicate where processing failed.
Error codes.
Enumerator | |
---|---|
TemplateNotFound |
Loader: A template was not found. |
UnknownToken |
Tokenizer: Unknown token. |
SyntaxError |
Parser: Syntax error. |
BadEndblockName |
Parser: The block name given in a blockend tag did not match the one given in the block tag. |
NonConstantExpression |
Compiler: A value which is needed to be constant was not a constant. |
EmptyTemplateName |
Compiler: Template name given in include or extend command is empty. |
NoParentBlock |
Compiler: A call to to parent() outside of a block or in the initial block declaration was found. |
InvalidRegularExpression |
Compiler: The regular expression for a 'matches' test was invalid. |
InvalidEscapeMode |
Compiler, Renderer: Unknown escape-mode given to a autoescape block or the escape() filter. |
NoProgram |
Renderer: No parsed program available. |
VariableNotSet |
Renderer: A needed variable is not set. |
Nuria::TemplateError::TemplateError | ( | Component | component = None , |
Error | error = NoError , |
||
const QString & | what = QString() , |
||
Template::Location | location = Template::Location() |
||
) |
Constructor.
Nuria::TemplateError::TemplateError | ( | const TemplateError & | other | ) |
Copy constructor.
Nuria::TemplateError::TemplateError | ( | TemplateError && | other | ) |
Move constructor.
Nuria::TemplateError::~TemplateError | ( | ) |
Destructor.
Component Nuria::TemplateError::component | ( | ) | const |
Returns the component which threw the error.
QString Nuria::TemplateError::componentName | ( | ) | const |
Returns the name of the component.
|
static |
Returns the name of the component.
Error Nuria::TemplateError::error | ( | ) | const |
Returns the error code.
QString Nuria::TemplateError::errorName | ( | ) | const |
Returns the name of the error code.
|
static |
Returns the human-readable name for error.
bool Nuria::TemplateError::hasFailed | ( | ) | const |
Returns true
if this object contains an error.
Template::Location Nuria::TemplateError::location | ( | ) | const |
Returns the location where in the Twig code the error occured.
TemplateError& Nuria::TemplateError::operator= | ( | const TemplateError & | other | ) |
Assignment operator.
TemplateError& Nuria::TemplateError::operator= | ( | TemplateError && | other | ) |
Move assignment operator.
QString Nuria::TemplateError::what | ( | ) | const |
Returns the further description of the error.