From: Alexander Ebert Date: Sun, 17 Mar 2024 15:30:18 +0000 (+0100) Subject: Rebuild JS artifacts X-Git-Tag: 6.1.0_Alpha_1~148^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6a5261b5f662c1195b8c4d7ea1f5058b607b5f0a;p=GitHub%2FWoltLab%2FWCF.git Rebuild JS artifacts --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Error.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Error.js index cb571bbf8a..3360323316 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Error.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Error.js @@ -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; + } + } }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Result.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Result.js index 76fa08ce86..2dce313e22 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Result.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Api/Result.js @@ -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; }