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

source-academy / js-slang / 5936042370

22 Aug 2023 07:58AM UTC coverage: 83.014% (+0.1%) from 82.893%
5936042370

Pull #1471

github

web-flow
Merge 6d88e2972 into 1d991166b
Pull Request #1471: Use Asynchronous Code for Loading Modules

3618 of 4779 branches covered (75.71%)

Branch coverage included in aggregate %.

269 of 269 new or added lines in 23 files covered. (100.0%)

10838 of 12635 relevant lines covered (85.78%)

106101.79 hits per line

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

60.87
/src/modules/errors.ts
1
import type * as es from 'estree'
2

3
import { RuntimeSourceError } from '../errors/runtimeSourceError'
67✔
4

5
export class UndefinedImportError extends RuntimeSourceError {
67✔
6
  constructor(
7
    public readonly symbol: string,
2✔
8
    public readonly moduleName: string,
2✔
9
    node?: es.ImportSpecifier
10
  ) {
11
    super(node)
2✔
12
  }
13

14
  public explain(): string {
15
    return `'${this.moduleName}' does not contain a definition for '${this.symbol}'`
1✔
16
  }
17

18
  public elaborate(): string {
19
    return "Check your imports and make sure what you're trying to import exists!"
×
20
  }
21
}
22

23
export class ModuleConnectionError extends RuntimeSourceError {
67✔
24
  private static message: string = `Unable to get modules.`
67✔
25
  private static elaboration: string = `You should check your Internet connection, and ensure you have used the correct module path.`
67✔
26
  constructor(node?: es.Node) {
27
    super(node)
2✔
28
  }
29

30
  public explain() {
31
    return ModuleConnectionError.message
×
32
  }
33

34
  public elaborate() {
35
    return ModuleConnectionError.elaboration
×
36
  }
37
}
38

39
export class ModuleNotFoundError extends RuntimeSourceError {
67✔
40
  constructor(public moduleName: string, node?: es.Node) {
×
41
    super(node)
×
42
  }
43

44
  public explain() {
45
    return `Module "${this.moduleName}" not found.`
×
46
  }
47

48
  public elaborate() {
49
    return `
×
50
      You should check your import declarations, and ensure that all are valid modules.
51
    `
52
  }
53
}
54

55
export class ModuleInternalError extends RuntimeSourceError {
67✔
56
  constructor(public moduleName: string, public error?: any, node?: es.Node) {
3✔
57
    super(node)
3✔
58
  }
59

60
  public explain() {
61
    return `Error(s) occured when executing the module "${this.moduleName}".`
×
62
  }
63

64
  public elaborate() {
65
    return `
×
66
      You may need to contact with the author for this module to fix this error.
67
    `
68
  }
69
}
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

© 2025 Coveralls, Inc