Currently, if you input an incorrect mana service URL in your config
(http rather than https for example) the error message you are given is
the direct output of a failed json parse. We should be able to catch
such failures and display a more meaningful error to the end user.
This patch makes it display a more friendly message.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
my $response = $userAgent->request($mana_request);
+ if ( $response->code != 200 ) {
+ return {
+ code => $response->code,
+ msg => $response->message,
+ };
+ }
+
eval { $result = from_json( $response->decoded_content, { utf8 => 1} ); };
$result->{code} = $response->code;
if ( $@ ){
<div class="col-sm-6">
[% IF result.code != 201 && result.msg %]
<div class="dialog alert" role="alert">
- [% result.msg | html %]
+ Error trying to connect or read response from the Mana server (Code: [% result.code | html %]) [% result.msg | html %]
</div>
[% END %]