KSeExpr 6.0.0.0
ErrorMessages.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "ErrorMessages.h"
5
6using namespace KSeExpr;
7
9{
10 switch (code)
11 {
12 case ErrorCode::None:
13 return QString();
14 case ErrorCode::ExpectedStringOrFloatAnyD:
15 return tr("Expected string or float[d]");
16 case ErrorCode::ExpectedFloatAnyD:
17 return tr("Expected float[d]");
18 case ErrorCode::ExpectedFloatD:
19 return tr("Expected float[%1]");
20 case ErrorCode::TypeMismatch12:
21 return tr("Type mismatch, first: '%1'; second: '%2'");
22 case ErrorCode::ExpectedFloatOrFloat3:
23 return tr("Expected float or float[3]");
24 case ErrorCode::ArgumentTypeMismatch:
25 return tr("Expected '%1' for argument, got '%2'");
26 case ErrorCode::WrongNumberOfArguments:
27 return tr("Wrong number of arguments, should be 1 to 7");
28 case ErrorCode::WrongNumberOfArgumentsMultiple3Plus1:
29 return tr("Wrong number of arguments, should be multiple of 3 plus 1");
30 case ErrorCode::WrongNumberOfArguments1Plus:
31 return tr("Wrong number of arguments, should be 1 or more");
32 case ErrorCode::FirstArgumentNotString:
33 return tr("First argument must be a string");
34 case ErrorCode::IncompleteFormatSpecifier:
35 return tr("Incomplete format specifier");
36 case ErrorCode::UndeclaredVariable:
37 return tr("No variable named '%1'");
38 case ErrorCode::UndeclaredFunction:
39 return tr("Function '%1' has no definition");
40 case ErrorCode::BadAssignmentOperator:
41 return tr("Assignment operation has incorrect type '%1'");
42 case ErrorCode::ConditionalTypesNotCompatible:
43 return tr("Types of conditional are not compatible");
44 case ErrorCode::InconsistentDefinition:
45 return tr("Variable '%1' defined in conditionals inconsistently");
46 case ErrorCode::FunctionTooFewArguments:
47 return tr("Too few arguments for function '%1'");
48 case ErrorCode::FunctionTooManyArguments:
49 return tr("Too many arguments for function '%1'");
50 case ErrorCode::ExpressionIncompatibleTypes:
51 return tr("Expression generated type '%1', incompatible with desired type '%2'");
52 case ErrorCode::SyntaxError:
53 return tr("Syntax error near '%1'");
54 case ErrorCode::UnexpectedEndOfExpression:
55 return tr("Unexpected end of expression near '%1'");
56 case ErrorCode::UnexpectedEndOfFormatString:
57 return tr("Unexpected end of format string");
58 case ErrorCode::InvalidFormatString:
59 return tr("Invalid format string, only %v or %f is allowed");
60 case ErrorCode::WrongNumberOfArgumentsForFormatString:
61 return tr("Wrong number of arguments for format string");
62 case ErrorCode::Unknown:
63 default:
64 return tr("Unknown error (message = %1)");
65 }
66}
static QString message(KSeExpr::ErrorCode code)