mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-12 00:56:40 +00:00
chore: warn on service reinitialization rather than throw
This commit is contained in:
parent
c72857c885
commit
771fb00d62
@ -9,12 +9,12 @@ export function mkSingleton<TConfig, TInstance>(
|
||||
|
||||
return (config?: TConfig): TInstance => {
|
||||
if (instance && config) {
|
||||
console.error(new Error().stack)
|
||||
throw new Error('Attempted to initialize service twice.')
|
||||
console.warn('Attempted to initialize service twice.')
|
||||
console.warn(new Error().stack)
|
||||
}
|
||||
|
||||
if (!instance && !config) {
|
||||
console.error(new Error().stack)
|
||||
console.warn(new Error().stack)
|
||||
throw new Error('Attempted to use service before initialization.')
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user