fixed httpclient error logging

This commit is contained in:
piratefinn 2018-03-20 16:53:14 +00:00
parent 3e8767e481
commit 49bd7d2e0c
4 changed files with 6 additions and 34 deletions

View file

@ -78,24 +78,18 @@ export class RegisterComponent {
.register(data)
.subscribe(
result => {
console.log('registered!');
this.registerStatus = 'success';
console.log(this.registerStatus);
this.router.navigate(['/dashboard']);
},
error => {
console.log('Register Error');
console.log(error);
try {
console.log(error.error);
const jsonError = error.json();
console.log('boop');
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
this.registerStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
} catch (e) {
this.registerStatusError = 'There was a server error, please try again later.';
}
this.registerStatus = 'send_failed';
console.log(this.registerStatus);
}
);
}
@ -127,19 +121,13 @@ export class RegisterComponent {
.register(data)
.subscribe(
result => {
console.log('registered!');
this.registerStatus = 'success';
console.log(this.registerStatus);
this.router.navigate(['/dashboard']);
},
error => {
console.log('Register Error');
error =>
console.log(error);
try {
console.log(error.error);
const jsonError = error.json();
console.log('boop');
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
this.registerStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
} catch (e) {
this.registerStatusError = 'There was a server error, please try again later.';
}

View file

@ -105,23 +105,17 @@ export class AccountEditComponent implements OnInit {
.accountEditUpdate(submitData)
.subscribe(
result => {
console.log('data submitted!');
this.submitStatus = 'success';
console.log(this.submitStatus);
},
error => {
console.log('Edit Error');
console.log(error);
try {
console.log(error.error);
const jsonError = error.json();
console.log('boop');
this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
this.submitStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
} catch (e) {
this.submitStatusError = 'There was a server error, please try again later.';
}
this.submitStatus = 'send_failed';
console.log(this.submitStatus);
}
);
}
@ -131,7 +125,6 @@ export class AccountEditComponent implements OnInit {
if (!this.settingForm.valid && !this.settingCustomerForm.valid) {
console.log('Not Valid!');
this.submitStatus = 'validation_failed';
console.log(this.submitStatus);
return;
}

View file

@ -247,8 +247,7 @@ export class AddDataComponent implements OnInit {
console.log(error);
try {
console.log(error.error);
const jsonError = error.json();
this.transactionFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
this.transactionFormStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
} catch (e) {
this.transactionFormStatusError = 'There was a server error, please try again later.';
}

View file

@ -55,9 +55,7 @@ export class FeedbackComponent implements OnInit {
result => {
if ( result.success === true ) {
console.log('Successful Upload');
console.log(result);
this.feedbackFormStatus = 'success';
console.log(this.feedbackFormStatus);
this.feedbackForm.patchValue({
feedbacktext: '',
});
@ -65,22 +63,16 @@ export class FeedbackComponent implements OnInit {
console.log('Upload Error');
this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
this.feedbackFormStatus = 'send_failed';
console.log(this.feedbackFormStatus);
}
},
error => {
console.log('Upload Error');
console.log(error);
try {
console.log(error.error);
const jsonError = error.json();
console.log('boop');
this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
this.feedbackFormStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
} catch (e) {
this.feedbackFormStatusError = 'There was a server error, please try again later.';
}
this.feedbackFormStatus = 'send_failed';
console.log(this.feedbackFormStatus);
}
);
}