From fd9df05c48c09b4d7f39a3b401882bda226dedea Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 31 十月 2023 20:38:18 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/classes/lexSolutionProjectRequirementsController.cls |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/force-app/main/default/classes/lexSolutionProjectRequirementsController.cls b/force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
index 265a9ab..529c935 100644
--- a/force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
+++ b/force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
@@ -22,7 +22,7 @@
             res.userName = [select Name from User where Id =: res.userId].Name;
             maps.put('res', res);
         } catch (Exception e) {
-            String message = e.getDmlMessage(0);
+            String message = e.getMessage();
             maps.put('error', message);
             return maps;
         }
@@ -76,7 +76,18 @@
             update so;
             return '';
         } catch (Exception e) {
-            return e.getDmlMessage(0);
+            if (e.getMessage().contains(',')) {
+                System.debug(LoggingLevel.INFO, '*** e: ' + e);
+                String exc = '' + e.getMessage();
+                Integer left = exc.indexOf(':') + 1;
+                Integer right = exc.lastIndexOf(':');
+                String str = exc.substring(left,right);
+                left = str.indexOf(',') +  1;
+                String newStr = str.substring(left);
+                return newStr;
+            }else {
+                return e.getMessage();   
+            } 
         }
     }
     @AuraEnabled
@@ -88,7 +99,18 @@
             update so;
             return '';
         } catch (Exception e) {
-            return e.getDmlMessage(0);
+            if (e.getMessage().contains(',')) {
+                System.debug(LoggingLevel.INFO, '*** e: ' + e);
+                String exc = '' + e.getMessage();
+                Integer left = exc.indexOf(':') + 1;
+                Integer right = exc.lastIndexOf(':');
+                String str = exc.substring(left,right);
+                left = str.indexOf(',') +  1;
+                String newStr = str.substring(left);
+                return newStr;
+            }else {
+                return e.getMessage();   
+            } 
         }
     }
 

--
Gitblit v1.9.1