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

Add reader.errmsg().

parent 0f24c22a
...@@ -87,6 +87,17 @@ time the file was checked. ...@@ -87,6 +87,17 @@ time the file was checked.
XXX ... 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(): .. _file.version():
STRING version() STRING version()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
varnishtest "reader.error()" varnishtest "reader.error()"
shell {echo -n "foo bar baz quux" > ${tmpdir}/error} shell {touch ${tmpdir}/error}
varnish v1 -vcl { varnish v1 -vcl {
import ${vmod_file}; import ${vmod_file};
...@@ -18,6 +18,7 @@ varnish v1 -vcl { ...@@ -18,6 +18,7 @@ varnish v1 -vcl {
sub vcl_synth { sub vcl_synth {
set resp.http.Error = rdr.error(); set resp.http.Error = rdr.error();
set resp.http.Errmsg = rdr.errmsg();
return (deliver); return (deliver);
} }
} -start } -start
...@@ -27,14 +28,21 @@ client c1 { ...@@ -27,14 +28,21 @@ client c1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.Error == "false" expect resp.http.Error == "false"
expect resp.http.Errmsg == "No error"
} -run } -run
shell {rm -f ${tmpdir}/error} shell {rm -f ${tmpdir}/error}
delay .1 delay .1
client c1 { client c2 {
txreq txreq
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.Error == "true" expect resp.http.Error == "true"
expect resp.http.Errmsg ~ "^vmod file failure: rdr: cannot read info about"
} -run } -run
shell {touch ${tmpdir}/error}
delay .1
client c1 -run
...@@ -514,6 +514,16 @@ vmod_reader_error(VRT_CTX, struct VPFX(file_reader) *rdr) ...@@ -514,6 +514,16 @@ vmod_reader_error(VRT_CTX, struct VPFX(file_reader) *rdr)
return (rdr->flags & RDR_ERROR); 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 VCL_STRING
vmod_version(VRT_CTX) vmod_version(VRT_CTX)
{ {
......
...@@ -64,6 +64,14 @@ time the file was checked. ...@@ -64,6 +64,14 @@ time the file was checked.
XXX ... 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() $Function STRING version()
Return the version string for this VMOD. 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