summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-05-12 12:22:22 +0200
committerYorhel <git@yorhel.nl>2018-05-12 12:22:22 +0200
commit5976dde89661c4af87c950feb1f45139b0d5c6f4 (patch)
tree0cc4ac5a7346ae9ce5f4c89e810b03c1d24a3459
parentcc26eedd495cd230e2cc45423f9d98000adde6d8 (diff)
Log reqJSON() on error
-rw-r--r--lib/TUWF.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/TUWF.pm b/lib/TUWF.pm
index 6818f9e..3d87ddb 100644
--- a/lib/TUWF.pm
+++ b/lib/TUWF.pm
@@ -487,7 +487,10 @@ sub _handle_error {
"HTTP Request Headers:\n".
join('', map sprintf(" %s: %s\n", $_, $self->reqHeader($_)), $self->reqHeader).
"POST dump:\n".
- join('', map sprintf(" %s: %s\n", $_, join "\n ", $self->reqPosts($_)), $self->reqPosts).
+ ($self->reqJSON()
+ ? JSON::XS->new->pretty->encode($self->reqJSON())
+ : join('', map sprintf(" %s: %s\n", $_, join "\n ", $self->reqPosts($_)), $self->reqPosts)
+ ).
"Error:\n $err\n"
) if ref $err ne 'TUWF::Exception';
}