Add debugging option to make bus warnings throw Error; bump version

orm-types
Garrett Mills 2 years ago
parent 467721f775
commit dbe48ea8a5

@ -1,6 +1,6 @@
{
"name": "@extollo/lib",
"version": "0.9.6",
"version": "0.9.7",
"description": "The framework library that lifts up your code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

@ -8,7 +8,7 @@ import {
EventHandlerReturn,
EventHandlerSubscription,
} from './types'
import {Awaitable, Collection, Pipeline, uuid4} from '../../util'
import {Awaitable, Collection, ifDebugging, Pipeline, uuid4} from '../../util'
import {Logging} from '../../service/Logging'
import {Unit} from '../../lifecycle/Unit'
import {Config} from '../../service/Config'
@ -185,6 +185,9 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
async up(): Promise<void> {
if ( this.isUp ) {
this.logging.warn('Attempted to boot more than once. Skipping.')
ifDebugging('extollo.bus', () => {
throw new Error('Attempted to boot more than once. Skipping.')
})
return
}

@ -1,6 +1,6 @@
import {Inject, Injectable, StaticInstantiable} from '../../di'
import {BusSubscriber, Event, EventBus, EventHandler, EventHandlerReturn, EventHandlerSubscription} from './types'
import {Awaitable, Collection, Pipeline, uuid4} from '../../util'
import {Awaitable, Collection, ifDebugging, Pipeline, uuid4} from '../../util'
import {Logging} from '../../service/Logging'
import {Bus, BusInternalSubscription} from './Bus'
import {getEventName} from './getEventName'
@ -109,6 +109,9 @@ export class LocalBus<TEvent extends Event = Event> extends CanonicalItemClass i
async up(): Promise<void> {
if ( this.isUp ) {
this.logging.warn('Attempted to boot more than once. Skipping.')
ifDebugging('extollo.bus', () => {
throw new Error('Attempted to boot more than once. Skipping.')
})
return
}

Loading…
Cancel
Save