System
Trigger test 404 and 500 errors to check your error handling, and fetch the project's API request count.
More information about the module's user interface: https://doc.oneentry.cloud/docs/category/system (opens in a new tab)
test404() and test500() call endpoints that always respond with a 404 or 500 error, so you can check that your error pages and error handling work before users hit a real failure. They don't redirect anywhere: you get the error response, and your app decides what to show. getApiStat() fetches the project's API request count per day.
Quickstart
Initialize the module from defineOneEntry:
const { } = defineOneEntry( , { });
Fetch the project's API request count:
// Resolves to an array of { [date]: count } objects, e.g. [{ "2026-10-25": 17280 }].
const stat = await System.getApiStat();
if ('statusCode' in stat) throw new Error(stat.message);
console.log('API usage:', stat);
With the default configuration (isShell: true), test404() and test500() don't throw. They resolve to the error object, so check statusCode:
const result = await System.test404();
if (typeof result === 'object' && result !== null && 'statusCode' in result) {
// Your 404 handling runs here.
console.log('404 handler fired', result.statusCode); // 404
}
With errors: { isShell: false } in the defineOneEntry config, the same calls throw, and you handle them with try/catch (see Errors):
try {
await System.test404();
} catch (error) {
// Your 404 handling runs here.
console.log('404 handler fired', error.statusCode); // 404
}
Testing error pages
1. Develop custom 404 and 500 pages
↓
2. Implement error handling (try/catch, error boundaries)
↓
3. Trigger errors with System.test404() / System.test500()
↓
4. Verify your error pages display correctly
↓
5. Remove the test calls before deploying to production
Call the test methods only in development or staging. Real 404 and 500 errors reach your code the same way, so the same handling covers them: check the returned error object, or use try/catch when isShell is false.
The module only triggers the errors. The error pages, logging and monitoring are up to your app or third-party tools; the test calls help you confirm that they fire.
API usage
getApiStat() resolves to the project's API request count per day, as an array of single-key objects: [{ "2026-10-25": 17280 }, …]. It covers at most the last three days (UTC, including today); days without requests are left out.
Methods
| Method | Description | Error | Use Case |
|---|---|---|---|
| test404() | Simulate 404 Not Found error | 404 Error | Test 404 error page |
| test500() | Simulate 500 Server Error | 500 Error | Test 500 error page |
| getApiStat() | Fetch the API request count | n/a | Monitor API usage |