diff --git a/src/Space.ts b/src/Space.ts index 7ef7b156..9c3f35dd 100644 --- a/src/Space.ts +++ b/src/Space.ts @@ -142,7 +142,9 @@ class Space extends EventEmitter { const self = await this.members.getSelf(); if (!isObject(profileDataOrUpdateFn) && !isFunction(profileDataOrUpdateFn)) { - throw new Error('Space.updateProfileData(): Invalid arguments: ' + inspect([profileDataOrUpdateFn])); + throw new InvalidArgumentError( + 'Space.updateProfileData(): Invalid arguments: ' + inspect([profileDataOrUpdateFn]), + ); } const update = { diff --git a/src/utilities/EventEmitter.ts b/src/utilities/EventEmitter.ts index 358b74c6..247645a2 100644 --- a/src/utilities/EventEmitter.ts +++ b/src/utilities/EventEmitter.ts @@ -278,7 +278,7 @@ export default class EventEmitter { const eventThis = { event: targetState }; if (typeof targetState !== 'string' || typeof currentState !== 'string') { - throw 'whenState requires a valid event String argument'; + throw new InvalidArgumentError('whenState requires a valid event String argument'); } if (typeof listener !== 'function' && Promise) { return new Promise((resolve) => {