-
-
Notifications
You must be signed in to change notification settings - Fork 70
/
constants.js
58 lines (56 loc) 路 2.23 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict'
/**
* Copyright 2016-present, Dustin Deus (deusdustin@gmail.com)
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const NATS = require('nats')
module.exports = {
// General
NATS_QUEUEGROUP_PREFIX: 'queue',
// NATS conn error codes
NATS_CONN_ERROR_CODES: [
NATS.CONN_ERR,
NATS.SECURE_CONN_REQ,
NATS.NON_SECURE_CONN_REQ,
NATS.CLIENT_CERT_REQ
],
// NATS errors
NATS_TRANSPORT_ERROR: 'Could not connect to NATS!',
NATS_TRANSPORT_CLOSED: 'NATS connection closed!',
NATS_TRANSPORT_CONNECTED: 'Connected!',
NATS_PERMISSION_ERROR: 'NATS permission error',
NATS_TRANSPORT_RECONNECTING: 'NATS reconnecting ...',
NATS_TRANSPORT_RECONNECTED: 'NATS reconnected!',
NATS_TRANSPORT_DISCONNECTED: 'NATS disconnected!',
// Hemera request types
REQUEST_TYPE_PUBSUB: 'pubsub',
REQUEST_TYPE_REQUEST: 'request',
// Application errors
TOPIC_SID_REQUIRED_FOR_DELETION: 'Topic or sid is required for deletion',
ACT_TIMEOUT_ERROR: 'Timeout',
NO_TOPIC_TO_SUBSCRIBE: 'No topic to subscribe',
NO_TOPIC_TO_REQUEST: 'No topic to request',
PATTERN_ALREADY_IN_USE: 'Pattern is already in use',
PATTERN_NOT_FOUND: 'No handler found for this pattern',
PAYLOAD_PARSING_ERROR: 'Invalid payload',
ADD_MIDDLEWARE_ERROR: 'Middleware error',
ADD_ADDED: 'ADD - ADDED',
BUSINESS_ERROR: 'Business error',
EXTENSION_ERROR: 'Extension error',
INVALID_EXTENSION: 'Invalid extension type',
INVALID_EXTENSION_HANDLER: 'Extension must be from type "function"',
MISSING_DECORATE_DEPENDENCY: 'Missing decorate dependency',
DECORATION_ALREADY_DEFINED: 'Decoration has been already added',
ACT_PATTERN_REQUIRED: 'Pattern is required to start an act call',
ADD_PATTERN_REQUIRED: 'Pattern is required to define an add',
REPLY_ALREADY_SENT: 'Reply already sent',
TRANSPORT_OPTIONS_DIFFER:
'Transport options differ from the first registration to this topic',
TRANSPORT_OPTIONS_DIFFER_DESC:
'Could not register pattern "%s" because pattern "%s" has different transport configuration but the same topic. Please use a different topic name!',
PLUGIN_DEP_STRINGS: 'The dependencies should be an array of strings'
}