Commit 38f67414 authored by Geoff Simmons's avatar Geoff Simmons

Add reader.errmsg().

parent 0f24c22a
......@@ -87,6 +87,17 @@ time the file was checked.
XXX ...
.. _xreader.errmsg():
STRING xreader.errmsg()
-----------------------
Returns the error message for any error condition determined the last
time the file was checked, or a message indicating that there was no
error.
XXX ...
.. _file.version():
STRING version()
......
......@@ -2,7 +2,7 @@
varnishtest "reader.error()"
shell {echo -n "foo bar baz quux" > ${tmpdir}/error}
shell {touch ${tmpdir}/error}
varnish v1 -vcl {
import ${vmod_file};
......@@ -18,6 +18,7 @@ varnish v1 -vcl {
sub vcl_synth {
set resp.http.Error = rdr.error();
set resp.http.Errmsg = rdr.errmsg();
return (deliver);
}
} -start
......@@ -27,14 +28,21 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.http.Error == "false"
expect resp.http.Errmsg == "No error"
} -run
shell {rm -f ${tmpdir}/error}
delay .1
client c1 {
client c2 {
txreq
rxresp
expect resp.status == 200
expect resp.http.Error == "true"
expect resp.http.Errmsg ~ "^vmod file failure: rdr: cannot read info about"
} -run
shell {touch ${tmpdir}/error}
delay .1
client c1 -run
......@@ -514,6 +514,16 @@ vmod_reader_error(VRT_CTX, struct VPFX(file_reader) *rdr)
return (rdr->flags & RDR_ERROR);
}
VCL_STRING
vmod_reader_errmsg(VRT_CTX, struct VPFX(file_reader) *rdr)
{
CHECK_OBJ_NOTNULL(rdr, FILE_READER_MAGIC);
(void)ctx;
AN(rdr->errbuf);
return (rdr->errbuf);
}
VCL_STRING
vmod_version(VRT_CTX)
{
......
......@@ -64,6 +64,14 @@ time the file was checked.
XXX ...
$Method STRING .errmsg()
Returns the error message for any error condition determined the last
time the file was checked, or a message indicating that there was no
error.
XXX ...
$Function STRING version()
Return the version string for this VMOD.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment