@dxos/network-manager 2.12.21 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,9 @@ import assert from 'assert';
6
6
  import debug from 'debug';
7
7
 
8
8
  import { Event } from '@dxos/async';
9
+ import { GreetingCommandPlugin, ERR_GREET_ALREADY_CONNECTED_TO_SWARM } from '@dxos/credentials';
9
10
  import { PublicKey } from '@dxos/crypto';
10
- import { Protocol } from '@dxos/protocol';
11
+ import { Protocol, ERR_EXTENSION_RESPONSE_FAILED } from '@dxos/protocol';
11
12
  import { ComplexMap } from '@dxos/util';
12
13
 
13
14
  import { ConnectionLog } from './connection-log';
@@ -89,7 +90,7 @@ export class NetworkManager {
89
90
  log(`Join ${options.topic} as ${options.peerId} with ${options.topology.toString()} topology.`);
90
91
 
91
92
  if (this._swarms.has(topic)) {
92
- throw new Error(`Already connected to swarm ${topic}`);
93
+ throw new ERR_EXTENSION_RESPONSE_FAILED(GreetingCommandPlugin.EXTENSION_NAME, ERR_GREET_ALREADY_CONNECTED_TO_SWARM, `Already connected to swarm ${topic}`);
93
94
  }
94
95
 
95
96
  const swarm = new Swarm(