17 using System.Collections.Generic;
20 namespace erminas.SmartAPI.Exceptions
68 internal static class ErrorCodeUtils
70 internal static ErrorCode ToErrorCode(
this string value)
72 if (value ==
"Please Login")
76 if (value.Trim() ==
"No right")
89 private const string RESPONSE =
"response";
90 private const string SERVER =
"server";
91 private const string ERROR_MESSAGE =
"error_message";
95 private readonly List<Tuple<string, string>> _errorCodes =
new List<Tuple<string, string>>
97 Tuple.Create(
"No right",
"The user does not have the required privileges."),
98 Tuple.Create(
"Please Login",
99 "The user session has timed out or the Login GUID is no longer valid. Please login again."),
100 Tuple.Create(
"RDError1",
"The number of modules in the license key does not correspond to the checksum."),
101 Tuple.Create(
"RDError2",
"The license key is only valid for the Beta test."),
102 Tuple.Create(
"RDError3",
103 "The license key is not correct. An error which could not be classified has occurred during the check."),
104 Tuple.Create(
"RDError4",
"License is no longer valid."),
105 Tuple.Create(
"RDError5",
"The server IP address is different than specified in the license."),
106 Tuple.Create(
"RDError6",
"License is not yet valid."),
107 Tuple.Create(
"RDError7",
108 "License is a cluster license. This error message is no longer supported beginning with CMS 6.0."),
109 Tuple.Create(
"RDError8",
"The IP address check in the license key is not correct."),
110 Tuple.Create(
"RDError9",
"Invalid version of the license key."),
111 Tuple.Create(
"RDError10",
"There are duplicate modules in the license."),
112 Tuple.Create(
"RDError11",
"A module in the license is flawed."),
113 Tuple.Create(
"RDError12",
"There are illegal characters in the license."),
114 Tuple.Create(
"RDError13",
"The checksum is not correct."),
115 Tuple.Create(
"RDError14",
"The serial number in the license is not correct."),
116 Tuple.Create(
"RDError15",
117 "The serial number of the license key is different from the serial number of the previous license key."),
118 Tuple.Create(
"RDError16",
"The IP address of the Loopback adapter is not supported in this license."),
119 Tuple.Create(
"RDError17",
"The license key contains no valid serial number."),
120 Tuple.Create(
"RDError101",
"The user is already logged on."),
121 Tuple.Create(
"RDError110",
122 "The user does not have the required privileges to execute the RQL. The cause of this situation may be that the logon GUID or session key has expired or the session has timed out."),
123 Tuple.Create(
"RDError201",
"Access to database \"ioAdministration\" has failed."),
124 Tuple.Create(
"RDError301",
"Defective asynchronous component."),
125 Tuple.Create(
"RDError401",
"A project is locked for the executing user or the user level."),
126 Tuple.Create(
"RDError510",
"The application server is not available."),
127 Tuple.Create(
"RDError511",
"The application server or the Management Server databases are updated."),
128 Tuple.Create(
"RDError707",
"The Login GUID does not correspond to the logged on user."),
129 Tuple.Create(
"RDError800",
"The maximum number of logins for a user has been reached."),
130 Tuple.Create(
"RDError2910",
"References still point to elements of this page."),
131 Tuple.Create(
"RDError2911",
"At least one element is still assigned as target container to a link."),
132 Tuple.Create(
"RDError3000",
"Package already exists."),
133 Tuple.Create(
"RDError3032",
134 "You have tried to delete a content class on the basis of which pages have already been created."),
135 Tuple.Create(
"Error3049",
"Too many users to a license. Login to CMS failed. Please login again later."),
136 Tuple.Create(
"RDError4005",
"This user name already exists."),
137 Tuple.Create(
"RDError5001",
"The folder path could not be found or the folder does no longer exist."),
138 Tuple.Create(
"RDError6001",
"A file is already being used in the CMS."),
139 Tuple.Create(
"RDError15805",
"You have no right to delete this page."),
140 Tuple.Create(
"RDError16997",
141 "You cannot delete the content class. There are pages which were created on the basis of this content class in other projects.")
146 public RQLException(
string server,
string reason,
string responseXML) : base(server, reason)
150 Tuple<string, string> msg = _errorCodes.LastOrDefault(x => reason.Contains(x.Item1));
151 ErrorMessage = msg != null ? msg.Item2 : reason;
153 Response = responseXML;
157 : this(rqlException.Server, rqlException.ErrorMessage, rqlException.Response)
164 public string ErrorMessage
166 get {
return (Data[ERROR_MESSAGE] ??
"").ToString(); }
167 private set { Data.Add(ERROR_MESSAGE, value); }
170 public override string Message
172 get {
return string.Format(
"RQL request to '{0}' failed. Error message: '{1}'", Server, ErrorMessage); }
175 public string Response
177 get {
return (Data[RESPONSE] ??
"").ToString(); }
178 private set { Data.Add(RESPONSE, value); }