• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paed01 / bpmn-elements / 8873165299

29 Apr 2024 04:04AM UTC coverage: 99.642% (+0.05%) from 99.593%
8873165299

push

github

paed01
add test for using exclusive gateway as join or split

2787 of 2833 branches covered (98.38%)

Branch coverage included in aggregate %.

10577 of 10579 relevant lines covered (99.98%)

7380.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.73
/src/error/Errors.js
1
import { cloneMessage } from '../messageHelper.js';
3✔
2

3✔
3
class ActivityError extends Error {
3✔
4
  constructor(description, sourceMessage, inner) {
3✔
5
    super(description);
474✔
6
    this.type = 'ActivityError';
474✔
7
    this.name = this.constructor.name;
474✔
8
    this.description = description;
474✔
9
    if (sourceMessage)
474✔
10
      this.source = cloneMessage(sourceMessage, sourceMessage.content && sourceMessage.content.error && { error: undefined });
474✔
11
    if (inner) {
474✔
12
      this.inner = inner;
387✔
13
      if (inner.name) this.name = inner.name;
387✔
14
      if (inner.code) this.code = inner.code;
387✔
15
    }
387✔
16
  }
474✔
17
}
3✔
18

3✔
19
class RunError extends ActivityError {
3✔
20
  constructor(...args) {
3✔
21
    super(...args);
36✔
22
    this.type = 'RunError';
36✔
23
  }
36✔
24
}
3✔
25

3✔
26
class BpmnError extends Error {
3✔
27
  constructor(description, behaviour = {}, sourceMessage, inner) {
3✔
28
    const { errorCode } = behaviour;
87✔
29

87✔
30
    super(description);
87✔
31
    this.type = 'BpmnError';
87✔
32
    this.name = behaviour.name || this.constructor.name;
87✔
33
    this.description = description;
87✔
34
    this.code = ('errorCode' in behaviour && errorCode && errorCode.toString()) || behaviour.code;
87✔
35
    this.id = behaviour.id;
87✔
36
    if (sourceMessage)
87✔
37
      this.source = cloneMessage(sourceMessage, sourceMessage.content && sourceMessage.content.error && { error: undefined });
87✔
38
    if (inner) this.inner = inner;
87!
39
  }
87✔
40
}
3✔
41

3✔
42
export { ActivityError, BpmnError, RunError, makeErrorFromMessage };
3✔
43

3✔
44
function makeErrorFromMessage(errorMessage) {
219✔
45
  const { content } = errorMessage;
219✔
46

219✔
47
  if (isKnownError(content)) return content;
219✔
48

207✔
49
  const { error } = content;
207✔
50
  if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields && errorMessage.fields.routingKey}`);
219✔
51

201✔
52
  if (isKnownError(error)) return error;
219✔
53

60✔
54
  switch (error.type) {
60✔
55
    case 'ActivityError':
219✔
56
      return new ActivityError(
36✔
57
        error.message || error.description,
36✔
58
        error.source,
36✔
59
        error.inner ? error.inner : { code: error.code, name: error.name },
36✔
60
      );
36✔
61
    case 'RunError':
219✔
62
      return new RunError(
3✔
63
        error.message || error.description,
3✔
64
        error.source,
3✔
65
        error.inner ? error.inner : { code: error.code, name: error.name },
3!
66
      );
3✔
67
    case 'BpmnError':
219✔
68
      return new BpmnError(error.message || error.description, error, error.source);
21✔
69
  }
219✔
70

×
71
  return error;
×
72
}
219✔
73

3✔
74
function isKnownError(test) {
420✔
75
  if (test instanceof ActivityError) return test;
420✔
76
  if (test instanceof BpmnError) return test;
420✔
77
  if (test instanceof Error) return test;
420✔
78
}
420✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc