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

paed01 / bpmn-elements / 8594277410

08 Apr 2024 03:48AM UTC coverage: 99.593% (-0.02%) from 99.611%
8594277410

push

github

paed01
hoist process output to definition environment on process error

2809 of 2857 branches covered (98.32%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

5 existing lines in 1 file now uncovered.

10644 of 10651 relevant lines covered (99.93%)

7270.18 hits per line

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

90.74
/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);
468✔
6
    this.type = 'ActivityError';
468✔
7
    this.name = this.constructor.name;
468✔
8
    this.description = description;
468✔
9
    if (sourceMessage)
468✔
10
      this.source = cloneMessage(sourceMessage, sourceMessage.content && sourceMessage.content.error && { error: undefined });
468✔
11
    if (inner) {
468✔
12
      this.inner = inner;
384✔
13
      if (inner.name) this.name = inner.name;
384✔
14
      if (inner.code) this.code = inner.code;
384✔
15
    }
384✔
16
  }
468✔
17
}
3✔
18

3✔
19
class RunError extends ActivityError {}
3✔
20

3✔
21
class BpmnError extends Error {
3✔
22
  constructor(description, behaviour = {}, sourceMessage, inner) {
3✔
23
    const { errorCode } = behaviour;
87✔
24

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

3✔
37
export { ActivityError, BpmnError, RunError, makeErrorFromMessage };
3✔
38

3✔
39
function makeErrorFromMessage(errorMessage) {
216✔
40
  const { content } = errorMessage;
216✔
41
  if (isKnownError(content)) return content;
216✔
42

204✔
43
  const { error } = content;
204✔
44
  if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields && errorMessage.fields.routingKey}`);
216✔
45

198✔
46
  if (isKnownError(error)) return error;
216✔
47
  switch (error.type) {
57✔
48
    case 'ActivityError':
216✔
49
      return new ActivityError(
36✔
50
        error.message || error.description,
36✔
51
        error.source,
36✔
52
        error.inner ? error.inner : { code: error.code, name: error.name },
36✔
53
      );
36✔
54
    case 'RunError':
216!
UNCOV
55
      return new RunError(
×
UNCOV
56
        error.message || error.description,
×
UNCOV
57
        error.source,
×
58
        error.inner ? error.inner : { code: error.code, name: error.name },
×
59
      );
×
60
    case 'BpmnError':
216✔
61
      return new BpmnError(error.message || error.description, error, error.source);
21✔
62
  }
216✔
UNCOV
63

×
UNCOV
64
  return error;
×
65
}
216✔
66

3✔
67
function isKnownError(test) {
414✔
68
  if (test instanceof ActivityError) return test;
414✔
69
  if (test instanceof BpmnError) return test;
414✔
70
  if (test instanceof Error) return test;
414✔
71
}
414✔
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