What happens
When a plugin's activate() throws — e.g. a route collision with another plugin — the loader re-wraps the error as:
plugin <id>: activate() failed: Method 'GET' already declared for route '/.well-known/webfinger'
The original error's code (FST_ERR_DUPLICATED_ROUTE) is stripped in the wrap, so callers and tests can only string-match the message to distinguish a route collision from any other activation failure.
Evidence
Witnessed while deliberately colliding two plugins on /.well-known/webfinger (webfinger + remotestorage): https://github.com/JavaScriptSolidServer/plugins/tree/gh-pages/remotestorage (README, Findings — the collision test asserts on the message because the code is gone). Also REPORT.md there, bug #4.
Suggested fix
Preserve the original error when re-wrapping: copy code onto the wrapper, or use new Error(msg, { cause: err }) so both the code and the stack survive.
What happens
When a plugin's
activate()throws — e.g. a route collision with another plugin — the loader re-wraps the error as:The original error's
code(FST_ERR_DUPLICATED_ROUTE) is stripped in the wrap, so callers and tests can only string-match the message to distinguish a route collision from any other activation failure.Evidence
Witnessed while deliberately colliding two plugins on
/.well-known/webfinger(webfinger + remotestorage): https://github.com/JavaScriptSolidServer/plugins/tree/gh-pages/remotestorage (README, Findings — the collision test asserts on the message because the code is gone). Also REPORT.md there, bug #4.Suggested fix
Preserve the original error when re-wrapping: copy
codeonto the wrapper, or usenew Error(msg, { cause: err })so both the code and the stack survive.