mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
null checking error response model
This commit is contained in:
@@ -9,8 +9,10 @@ export abstract class BaseResponse {
|
||||
if (propertyName == null || propertyName === '') {
|
||||
throw new Error('propertyName must not be null/empty.');
|
||||
}
|
||||
if (response == null) {
|
||||
if (response == null && this.response != null) {
|
||||
response = this.response;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (!exactName && response[propertyName] === undefined) {
|
||||
let otherCasePropertyName: string = null;
|
||||
|
||||
@@ -8,11 +8,13 @@ export class ErrorResponse extends BaseResponse {
|
||||
constructor(response: any, status: number, identityResponse?: boolean) {
|
||||
super(response);
|
||||
let errorModel = null;
|
||||
const responseErrorModel = this.getResponseProperty('ErrorModel');
|
||||
if (responseErrorModel && identityResponse && response) {
|
||||
errorModel = responseErrorModel;
|
||||
} else if (response) {
|
||||
errorModel = response;
|
||||
if (response != null) {
|
||||
const responseErrorModel = this.getResponseProperty('ErrorModel');
|
||||
if (responseErrorModel && identityResponse) {
|
||||
errorModel = responseErrorModel;
|
||||
} else {
|
||||
errorModel = response;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorModel) {
|
||||
|
||||
Reference in New Issue
Block a user