mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
handle server errors for attachment save
This commit is contained in:
@@ -9,8 +9,6 @@ class ErrorResponse {
|
||||
errorModel = response.ErrorModel;
|
||||
} else if (response) {
|
||||
errorModel = response;
|
||||
//} else if (response.responseText && response.responseText.indexOf('{') === 0) {
|
||||
// errorModel = JSON.parse(response.responseText);
|
||||
}
|
||||
|
||||
if (errorModel) {
|
||||
@@ -19,6 +17,20 @@ class ErrorResponse {
|
||||
}
|
||||
this.statusCode = status;
|
||||
}
|
||||
|
||||
getSingleMessage(): string {
|
||||
if (this.validationErrors) {
|
||||
for (const key in this.validationErrors) {
|
||||
if (!this.validationErrors.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
if (this.validationErrors[key].length) {
|
||||
return this.validationErrors[key][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
||||
export { ErrorResponse };
|
||||
|
||||
Reference in New Issue
Block a user