Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-selector
Commits
33e4552f
Commit
33e4552f
authored
Sep 18, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the ERRORS section in the docs.
parent
3ca0331b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
30 deletions
+50
-30
README.rst
README.rst
+25
-15
vmod_selector.vcc
src/vmod_selector.vcc
+25
-15
No files found.
README.rst
View file @
33e4552f
...
@@ -983,21 +983,9 @@ state. They are removed permanently when the VCL instance is discarded
...
@@ -983,21 +983,9 @@ state. They are removed permanently when the VCL instance is discarded
ERRORS
ERRORS
======
======
The method documentation above refers to two kinds of failures: method
The method documentation above describes illegal uses for which VCL
failure and VCL failure.
failure is invoked. VCL failure has the same results as if
``return(fail)`` is called from a VCL subroutine:
When a method fails, an error message is written to the Varnish log
with the ``VCL_Error`` tag. If the method's return type allows for a
distinguished "error" value, such as NULL for ``.string()``, then that
value is returned. VCL processing can then continue (although your
code should of course check for the error).
For some return types, there is no such distinguished value; for
example for INT as returned by ``.integer()``. In such cases, VCL
failues is invoked.
VCL failure has the same results as if ``return(fail)`` is called from
a VCL subroutine:
* If the failure occurs in ``vcl_init``, then the VCL load fails with
* If the failure occurs in ``vcl_init``, then the VCL load fails with
an error message.
an error message.
...
@@ -1010,6 +998,28 @@ a VCL subroutine:
...
@@ -1010,6 +998,28 @@ a VCL subroutine:
* If the failure occurs in ``vcl_synth``, then ``vcl_synth`` is
* If the failure occurs in ``vcl_synth``, then ``vcl_synth`` is
aborted, and the response line "503 VCL failed" is sent.
aborted, and the response line "503 VCL failed" is sent.
VCL failure is meant to "fail fast" on conditions that cannot be
correct, or when resource limitations such as workspace exhaustion
prevent further processing. Depending on your use case, you may be
able to use the VMOD's methods without risk of failure. For example,
if it is known that none of the strings in a set have common prefixes,
then methods with ``select=UNIQUE`` can be used safely after calling
``.hasprefix()``.
If you need to check against possible failure conditions:
* If ``.nmatches() == 1``, then ``select=UNIQUE`` can be used safely.
* The ``UNIQUE`` and ``EXACT`` conditions can also be checked with
``.matched(select=UNIQUE)`` and ``.matched(select=EXACT)``.
* The ``allow_overlaps`` flag can be set in the constructor, to
ensure that VCL load fails if a set unintentionally has strings
with common prefixes.
See `LIMITATIONS`_ for considerations if you encounter conditions such
as workspace exhaustion.
LOGGING
LOGGING
=======
=======
...
...
src/vmod_selector.vcc
View file @
33e4552f
...
@@ -871,21 +871,9 @@ state. They are removed permanently when the VCL instance is discarded
...
@@ -871,21 +871,9 @@ state. They are removed permanently when the VCL instance is discarded
ERRORS
ERRORS
======
======
The method documentation above refers to two kinds of failures: method
The method documentation above describes illegal uses for which VCL
failure and VCL failure.
failure is invoked. VCL failure has the same results as if
``return(fail)`` is called from a VCL subroutine:
When a method fails, an error message is written to the Varnish log
with the ``VCL_Error`` tag. If the method's return type allows for a
distinguished "error" value, such as NULL for ``.string()``, then that
value is returned. VCL processing can then continue (although your
code should of course check for the error).
For some return types, there is no such distinguished value; for
example for INT as returned by ``.integer()``. In such cases, VCL
failues is invoked.
VCL failure has the same results as if ``return(fail)`` is called from
a VCL subroutine:
* If the failure occurs in ``vcl_init``, then the VCL load fails with
* If the failure occurs in ``vcl_init``, then the VCL load fails with
an error message.
an error message.
...
@@ -898,6 +886,28 @@ a VCL subroutine:
...
@@ -898,6 +886,28 @@ a VCL subroutine:
* If the failure occurs in ``vcl_synth``, then ``vcl_synth`` is
* If the failure occurs in ``vcl_synth``, then ``vcl_synth`` is
aborted, and the response line "503 VCL failed" is sent.
aborted, and the response line "503 VCL failed" is sent.
VCL failure is meant to "fail fast" on conditions that cannot be
correct, or when resource limitations such as workspace exhaustion
prevent further processing. Depending on your use case, you may be
able to use the VMOD's methods without risk of failure. For example,
if it is known that none of the strings in a set have common prefixes,
then methods with ``select=UNIQUE`` can be used safely after calling
``.hasprefix()``.
If you need to check against possible failure conditions:
* If ``.nmatches() == 1``, then ``select=UNIQUE`` can be used safely.
* The ``UNIQUE`` and ``EXACT`` conditions can also be checked with
``.matched(select=UNIQUE)`` and ``.matched(select=EXACT)``.
* The ``allow_overlaps`` flag can be set in the constructor, to
ensure that VCL load fails if a set unintentionally has strings
with common prefixes.
See `LIMITATIONS`_ for considerations if you encounter conditions such
as workspace exhaustion.
LOGGING
LOGGING
=======
=======
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment