fixed validations

This commit is contained in:
David Lebee 2021-02-08 12:21:44 -05:00
parent 3a3e5bdac6
commit fe2c6bfe02
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@poweredsoft/ngx-data", "name": "@poweredsoft/ngx-data",
"version": "0.0.15", "version": "0.0.16",
"peerDependencies": { "peerDependencies": {
"@angular/common": "^8.2.4", "@angular/common": "^8.2.4",
"@angular/core": "^8.2.4", "@angular/core": "^8.2.4",

View File

@ -101,7 +101,14 @@ export class HttpDataSourceOptionsBuilder<TModel, TKey> {
}); });
} }
if (typeof(err.error) == "object") { if (err.status == 400)
{
if (err.error && err.error.errors)
return throwError(<IDataSourceValidationError>{
type: 'validation',
errors: err.error.errors
});
// if status not okay then its an exception error // if status not okay then its an exception error
if (err.error.hasOwnProperty('Message') && typeof(err.error['Message']) == "string") { if (err.error.hasOwnProperty('Message') && typeof(err.error['Message']) == "string") {
return throwError(<IDataSourceErrorMessage>{ return throwError(<IDataSourceErrorMessage>{
@ -109,11 +116,6 @@ export class HttpDataSourceOptionsBuilder<TModel, TKey> {
message: err.error['Message'] message: err.error['Message']
}); });
} }
return throwError(<IDataSourceValidationError>{
type: 'validation',
errors: err.error.errors
});
} }
// general error message // general error message