You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to register a wrapper before the libWrapper.Ready hook, if this happens before game.modules is available, libWrapper will try to construct an error message and fail with an error message like:
[Detected 2 packages: lib-wrapper, XYZ]
at PackageInfo.get exists [as exists] (libWrapper-package_info.js:328)
at de (libWrapper-api.js:273)
at Function.🎁register [as register] (libWrapper-api.js:471)
at XYZ.js:5
To Reproduce
Steps to reproduce the behavior:
Write a module which calls libWrapper.register before the libWrapper.Ready hook fires.
Enter a world and enable the module.
Refresh.
See the error in the JS console.
Expected behavior
libWrapper should give the error Not allowed to register wrappers before the 'libWrapper.Ready' hook fires instead.
Technical Details (please complete the following information):
LibWrapper Version: 1.12.8.0 (and older)
FoundryVTT Version: Any
Browser & Version: Any
Additional context
This seems to be caused by api.js:475, which throws a LibWrapperPackageError exception when libWrapper isn't ready yet, which will trigger a PackageInfo::exists call during the error message construction.
This PackageInfo::exists method does not correctly handle the case where game.modules is undefined.
The text was updated successfully, but these errors were encountered:
ruipin
changed the title
[BUG] Incorrect error message when calling libWrapper.register before the libWrapper.Ready hook
[BUG] Incorrect error message when calling the libWrapper API before the libWrapper.Ready hook
Sep 11, 2022
Describe the bug
When trying to register a wrapper before the
libWrapper.Ready
hook, if this happens beforegame.modules
is available, libWrapper will try to construct an error message and fail with an error message like:To Reproduce
Steps to reproduce the behavior:
libWrapper.register
before thelibWrapper.Ready
hook fires.Expected behavior
libWrapper should give the error
Not allowed to register wrappers before the 'libWrapper.Ready' hook fires
instead.Technical Details (please complete the following information):
Additional context
This seems to be caused by
api.js:475
, which throws aLibWrapperPackageError
exception when libWrapper isn't ready yet, which will trigger aPackageInfo::exists
call during the error message construction.This
PackageInfo::exists
method does not correctly handle the case wheregame.modules
is undefined.The text was updated successfully, but these errors were encountered: