Better fix and change status to 400 for upload errors

This commit is contained in:
Tom Bloor 2017-08-17 15:45:26 +01:00
parent bc09479a61
commit d169249538

View file

@ -147,11 +147,14 @@ sub post_upload {
} }
unless ( defined $organisation ) { unless ( defined $organisation ) {
return $c->render( json => { return $c->render(
success => Mojo::JSON->false, json => {
message => 'Error Finding Organisation', success => Mojo::JSON->false,
error => 'organisation_error', message => 'Error Finding Organisation',
}); error => 'organisation_error',
},
status => 400,
);
} }
my $transaction_value = $validation->param('transaction_value'); my $transaction_value = $validation->param('transaction_value');
@ -171,11 +174,14 @@ sub post_upload {
); );
unless ( defined $new_transaction ) { unless ( defined $new_transaction ) {
return $c->render( json => { return $c->render(
success => Mojo::JSON->false, json => {
message => 'Error Adding Transaction', success => Mojo::JSON->false,
error => 'transaction_error', message => 'Error Adding Transaction',
}); error => 'transaction_error',
},
status => 400,
);
} }
return $c->render( json => { return $c->render( json => {