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

donatj / loggre / 16179981679

09 Jul 2025 08:54PM UTC coverage: 28.306% (+1.5%) from 26.772%
16179981679

push

github

donatj
Fix some error handling

32 of 79 branches covered (40.51%)

Branch coverage included in aggregate %.

0 of 7 new or added lines in 2 files covered. (0.0%)

90 of 352 relevant lines covered (25.57%)

23.06 hits per line

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

0.0
/src/logtypes/php-error.ts
1
import { LogEntry, LogType } from "./Logs";
2

3
export class PhpErrorLog implements LogType {
×
4

5
        looksLikeLogLine(line: string): boolean {
6
                return line[0] === '[';
×
7
        }
8

9
        parseLogLine(line: string): LogEntry {
10
                return new PhpErrorLogEntry(line);
×
11
        }
12

13
}
14

15
export class PhpErrorLogEntry implements LogEntry {
×
16

17
        constructor(public readonly log: string) {
×
18
                this.log = this.log.trim();
×
19
        }
20

21
        getRawEntry(): string {
22
                return this.log;
×
23
        }
24

25
        getMessage(): string {
NEW
26
                const match = this.log.match(/(?<=] ).*/);
×
NEW
27
                return match ? match[0] : ""; // @todo Throw an error if no match found?
×
28
        }
29

30
        getDate(): Date {
NEW
31
                const match = this.log.match(/\[(.*?)\]/);
×
NEW
32
                if (!match) {
×
NEW
33
                        throw new Error("Log entry does not contain a valid date format.");
×
34
                }
35

NEW
36
                return new Date(match[1]);
×
37
        }
38

39
        hasDetails(): boolean {
40
                return this.log.includes("\n");
×
41
        }
42

43
}
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