null checking error response model
This commit is contained in:
parent
82f8f2b85e
commit
e9cbf7b7df
|
@ -9,8 +9,10 @@ export abstract class BaseResponse {
|
||||||
if (propertyName == null || propertyName === '') {
|
if (propertyName == null || propertyName === '') {
|
||||||
throw new Error('propertyName must not be null/empty.');
|
throw new Error('propertyName must not be null/empty.');
|
||||||
}
|
}
|
||||||
if (response == null) {
|
if (response == null && this.response != null) {
|
||||||
response = this.response;
|
response = this.response;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if (!exactName && response[propertyName] === undefined) {
|
if (!exactName && response[propertyName] === undefined) {
|
||||||
let otherCasePropertyName: string = null;
|
let otherCasePropertyName: string = null;
|
||||||
|
|
|
@ -8,11 +8,13 @@ export class ErrorResponse extends BaseResponse {
|
||||||
constructor(response: any, status: number, identityResponse?: boolean) {
|
constructor(response: any, status: number, identityResponse?: boolean) {
|
||||||
super(response);
|
super(response);
|
||||||
let errorModel = null;
|
let errorModel = null;
|
||||||
const responseErrorModel = this.getResponseProperty('ErrorModel');
|
if (response != null) {
|
||||||
if (responseErrorModel && identityResponse && response) {
|
const responseErrorModel = this.getResponseProperty('ErrorModel');
|
||||||
errorModel = responseErrorModel;
|
if (responseErrorModel && identityResponse) {
|
||||||
} else if (response) {
|
errorModel = responseErrorModel;
|
||||||
errorModel = response;
|
} else {
|
||||||
|
errorModel = response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorModel) {
|
if (errorModel) {
|
||||||
|
|
Loading…
Reference in New Issue