File indexing completed on 2024-12-01 04:48:05
0001 /* 0002 This file is part of oxaccess. 0003 0004 SPDX-FileCopyrightText: 2012 Marco Nelles <marco.nelles@credativ.com> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "oxerrors.h" 0010 0011 using namespace OXA; 0012 0013 OXErrors::EditErrorID OXErrors::getEditErrorID(const QString &errorText) 0014 { 0015 const int b1Pos = errorText.indexOf(QLatin1Char('[')); 0016 const int b2Pos = errorText.indexOf(QLatin1Char(']')); 0017 const QString errorID = errorText.mid(b1Pos + 1, b2Pos - b1Pos - 1); 0018 0019 bool ok; 0020 int eid = errorID.toInt(&ok); 0021 if (!ok) { 0022 return OXErrors::EditErrorUndefined; 0023 } 0024 0025 switch (eid) { 0026 case 1000: 0027 return OXErrors::ConcurrentModification; 0028 case 1001: 0029 return OXErrors::ObjectNotFound; 0030 case 1002: 0031 return OXErrors::NoPermissionForThisAction; 0032 case 1003: 0033 return OXErrors::ConflictsDetected; 0034 case 1004: 0035 return OXErrors::MissingMandatoryFields; 0036 case 1006: 0037 return OXErrors::AppointmentConflicts; 0038 case 1500: 0039 return OXErrors::InternalServerError; 0040 default:; 0041 } 0042 0043 return OXErrors::EditErrorUndefined; 0044 }