chore(lib/plugins): update init+ error message with hints

This commit is contained in:
PalmDevs 2026-08-01 15:43:34 +07:00
parent 73534bda6a
commit 912fa8e896
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -43,7 +43,8 @@ defineLazyProperties(pUnscopedApi, {
export function guardIndexInitialized(name: string) {
if (!isModuleInitialized(0))
throw new Error(
`Cannot access ${name} API before the init phase: Index module (ID 0) must be initialized first.`,
`Cannot access ${name} API before the init phase: Index module (ID 0) must be initialized first.\n` +
'Place your accessing code in the `init() { ... }` block or use `onModuleInitialized(0, () => { ... })` to ensure that the index module is initialized before accessing the API.',
)
}