fixed httpclient error logging

This commit is contained in:
piratefinn 2018-03-20 16:53:14 +00:00
parent e7c718250f
commit 2eddb4dd9c
4 changed files with 6 additions and 34 deletions

View file

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

View file

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

View file

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

View file

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