Rebuild JS artifacts
authorAlexander Ebert <ebert@woltlab.com>
Sun, 17 Mar 2024 15:30:18 +0000 (16:30 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 17 Mar 2024 15:30:18 +0000 (16:30 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Api/Error.js
wcfsetup/install/files/js/WoltLabSuite/Core/Api/Result.js

index cb571bbf8a089bfadff3f6f2702d85acb96b116e..3360323316b910877df437f3d481168197b5cce4 100644 (file)
@@ -7,12 +7,30 @@ define(["require", "exports"], function (require, exports) {
         code;
         message;
         param;
-        constructor(type, code, message, param) {
+        statusCode;
+        constructor(type, code, message, param, statusCode) {
             this.type = type;
             this.code = code;
             this.message = message;
             this.param = param;
+            this.statusCode = statusCode;
+        }
+        getValidationError() {
+            if (this.type !== "invalid_request_error" || this.statusCode !== 400) {
+                return undefined;
+            }
+            return new ValidationError(this.code, this.message, this.param);
         }
     }
     exports.ApiError = ApiError;
+    class ValidationError {
+        code;
+        message;
+        param;
+        constructor(code, message, param) {
+            this.code = code;
+            this.message = message;
+            this.param = param;
+        }
+    }
 });
index 76fa08ce8658c6b6792a015f629849d6f0603d83..2dce313e226f4cde882a3c33a0a307861cfedbbf 100644 (file)
@@ -45,7 +45,7 @@ define(["require", "exports", "../Core", "./Error"], function (require, exports,
             typeof json.code === "string" &&
             typeof json.message === "string" &&
             typeof json.param === "string") {
-            return apiResultFromError(new Error_1.ApiError(json.type, json.code, json.message, json.param));
+            return apiResultFromError(new Error_1.ApiError(json.type, json.code, json.message, json.param, response.status));
         }
         throw e;
     }