diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d83f3e..33b7601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Latest ------ +### Changes +* [#78](https://github.com/cleverage/cache-process-bundle/issues/78) Reference pages: exceptions of the bundle, input keys of `cache_get` / `cache_set`. + v2.3 ------ diff --git a/docs/index.md b/docs/index.md index 4ef81b1..e62f57f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -115,3 +115,10 @@ delete_from_cache: - [Share data between process branches](cookbooks/share_data_between_branches.md) - [Warm up a persistent cache from a file](cookbooks/cache_warmup.md) + +## Exceptions + +The exceptions named without namespace in the reference pages (e.g. `UnexpectedValueException`) are the ones of the +bundle, `CleverAge\CacheProcessBundle\Exception\*`: they extend the SPL exceptions of the same name and implement +`CleverAge\ProcessBundle\Exception\ProcessExceptionInterface`, so that all the errors of the process bundles can be +caught at once. diff --git a/docs/reference/adapter.md b/docs/reference/adapter.md index 1606347..8d52577 100644 --- a/docs/reference/adapter.md +++ b/docs/reference/adapter.md @@ -119,7 +119,7 @@ Notes * The adapters are registered by the `code` attribute of their tag, in a service locator built when the container is compiled: an adapter is only instantiated when a task uses it (an error in an adapter that a process does not use - does not make it fail). The `code` must be the one returned by `getCode()` (an `\UnexpectedValueException` is thrown + does not make it fail). The `code` must be the one returned by `getCode()` (an `UnexpectedValueException` is thrown otherwise when it is fetched). Two adapters with the same code, or an empty code, fail the container compilation. `AdapterRegistry::hasAdapter()` and `getAdapters()` (which instantiates every adapter) are available, e.g. in a custom cache task. @@ -130,7 +130,7 @@ Notes compilation. A pool must be tagged with a `code`. * **Deprecated**: a service tagged without `code` is still registered, with `AdapterRegistry::addAdapter()`, instantiated with the registry (deprecated since 2.3, the `code` will be required in 3.0). Two adapters with the same - code then throw an `\UnexpectedValueException` giving the ids of both services + code then throw an `UnexpectedValueException` giving the ids of both services (`Adapter is already defined by service "", cannot register service ""`) when the registry is instantiated, i.e. the first time a cache task is used. * Using a code that is not registered throws a `CleverAge\CacheProcessBundle\Exception\MissingAdapterException` diff --git a/docs/reference/tasks/get_task.md b/docs/reference/tasks/get_task.md index ca3ea27..d26d4c6 100644 --- a/docs/reference/tasks/get_task.md +++ b/docs/reference/tasks/get_task.md @@ -13,11 +13,11 @@ Task reference Accepted inputs --------------- -`array` or empty (`null`): if the input is not empty, its keys `adapter` and `key` override the options of the same -name, and are validated like the options (e.g. a non-string `key` throws an `InvalidOptionsException`). Other input -keys are ignored. +`array` or empty (`null`): if the input is not empty, its keys named after an option (`adapter`, `key`, `on_miss`) +override the options of the same name, and are validated like the options (e.g. a non-string `key` throws an +`InvalidOptionsException`). Other input keys are ignored. -Any other non-empty input (e.g. a `string`) throws an `\UnexpectedValueException`. +Any other non-empty input (e.g. a `string`) throws an `UnexpectedValueException`. Possible outputs ---------------- @@ -42,7 +42,7 @@ input, an option given by neither throws a `MissingOptionsException` on executio * `output_null`: output `null`, as for an item stored with a `null` value. * `skip`: skip the item and send the input to the error outputs (`error_outputs`), e.g. to compute the missing value and store it. -* `fail`: throw an `\UnexpectedValueException` (`Cache item is missing from adapter `). +* `fail`: throw an `UnexpectedValueException` (`Cache item is missing from adapter `). Examples -------- diff --git a/docs/reference/tasks/set_task.md b/docs/reference/tasks/set_task.md index 4f241e1..c3a61d1 100644 --- a/docs/reference/tasks/set_task.md +++ b/docs/reference/tasks/set_task.md @@ -13,11 +13,11 @@ Task reference Accepted inputs --------------- -`array` or empty (`null`): if the input is not empty, its keys `adapter`, `key` and `value` override the options of the -same name, and are validated like the options (e.g. a non-string `key` throws an `InvalidOptionsException`). Other -input keys are ignored. +`array` or empty (`null`): if the input is not empty, its keys named after an option (`adapter`, `key`, `value`, +`expires_after`) override the options of the same name, and are validated like the options (e.g. a non-string `key` +throws an `InvalidOptionsException`). Other input keys are ignored. -Any other non-empty input (e.g. a `string`) throws an `\UnexpectedValueException`. +Any other non-empty input (e.g. a `string`) throws an `UnexpectedValueException`. Possible outputs ----------------