|
2 | 2 |
|
3 | 3 | The error reporting endpoint was designed to allows the **frontend developers** of your API to report any bugs they encounter in a secure way that is fully under your control. |
4 | 4 |
|
5 | | -### Example case usage |
| 5 | +## Example case usage |
6 | 6 |
|
7 | 7 | - Frontend developed in Angular. |
8 | 8 | - Frontend developer will use try-catch in the code in order to send **frontend errors** back to the API |
@@ -47,18 +47,18 @@ Behind the scenes, the API validates your configuration and lets you know if any |
47 | 47 | Below are the requirements for an application to be able to send error messages to Dotkernel API. |
48 | 48 |
|
49 | 49 | - **Server-side requirements** stored in in `config/autoload/error-handling.global.php`; note these can be set/overwritten in `config/autoload/local.php`: |
50 | | - - All keys (`enabled`, `path`, `tokens`, `domain_whitelist` and `ip_whitelist`) must exist under `ErrorReportServiceInterface::class`. |
51 | | - - The error reporting feature must be enabled via `ErrorReportServiceInterface::class` . `enabled` => `true`. |
52 | | - - `ErrorReportServiceInterface::class` . `path` must have a value; if the destination file does not exist, it will be created automatically. |
53 | | - - `ErrorReportServiceInterface::class` . `tokens` must contain at least one token. |
54 | | - - At least one of `ErrorReportServiceInterface::class` . `domain_whitelist`/`ip_whitelist` must have at least one value. |
| 50 | + - All keys (`enabled`, `path`, `tokens`, `domain_whitelist` and `ip_whitelist`) must exist under `ErrorReportServiceInterface::class`. |
| 51 | + - The error reporting feature must be enabled via `ErrorReportServiceInterface::class` . `enabled` => `true`. |
| 52 | + - `ErrorReportServiceInterface::class` . `path` must have a value; if the destination file does not exist, it will be created automatically. |
| 53 | + - `ErrorReportServiceInterface::class` . `tokens` must contain at least one token. |
| 54 | + - At least one of `ErrorReportServiceInterface::class` . `domain_whitelist`/`ip_whitelist` must have at least one value. |
55 | 55 |
|
56 | 56 | **Note:** The function `checkRequest()` tries to validate the request by checking matches for `domain_whitelist` with `isMatchingDomain()` and for `ip_whitelist` with `isMatchingIpAddress()`. |
57 | 57 | If both return `false`, a `ForbiddenException` is thrown and the error message does not get stored. |
58 | 58 |
|
59 | 59 | - **Application-side requirements**: |
60 | | - - Send the `Error-Reporting-Token` header with a valid token previously stored in `config/autoload/error-handling.global.php` in the `ErrorReportServiceInterface::class` . `tokens` array. |
61 | | - - Send the `Origin` header set to the application's URL; this is the application that send the report. |
| 60 | + - Send the `Error-Reporting-Token` header with a valid token previously stored in `config/autoload/error-handling.global.php` in the `ErrorReportServiceInterface::class` . `tokens` array. |
| 61 | + - Send the `Origin` header set to the application's URL; this is the application that send the report. |
62 | 62 |
|
63 | 63 | **Note:** |
64 | 64 |
|
|
0 commit comments