chore(lib/modules/metro): alert module init errors in dev builds
This commit is contained in:
parent
3c657c36b2
commit
4f120ea159
1 changed files with 12 additions and 0 deletions
|
|
@ -1,3 +1,6 @@
|
|||
import { callBridgeMethodSync } from '@revenge-mod/modules/native'
|
||||
import { getErrorStack } from '@revenge-mod/utils/error'
|
||||
import { FullVersion } from '~constants'
|
||||
import { cache, cacheBlacklistedModule, Uncached } from '../caches'
|
||||
import {
|
||||
global,
|
||||
|
|
@ -128,6 +131,15 @@ function handleFactoryCall(
|
|||
}
|
||||
|
||||
executeInitializeSubscriptions(mInitializingId, exports)
|
||||
} catch (e) {
|
||||
if (__DEV__) {
|
||||
callBridgeMethodSync('revenge.alertError', [
|
||||
`Module ${mInitializingId} failed to initialize:\n\n${getErrorStack(e)}`,
|
||||
FullVersion,
|
||||
])
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
} finally {
|
||||
mUninitialized.delete(mInitializingId)
|
||||
mInitializingId = prevId
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue