Skip to content

Commit 4d5f92f

Browse files
committed
New error: undisclosed error by LEA. Playing with styles.
1 parent 1807e1d commit 4d5f92f

8 files changed

Lines changed: 24 additions & 8 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "berlin-lea-performance-monitor",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"author": "David Leclerc",
55
"main": "./src/index.ts",
66
"scripts": {

src/config/events.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NoAppointmentsError, NoInformationError, InternalServerError, MissingElementError, InfiniteSpinnerError, UIError, NoResultsError, ConstructionWorkError, ServiceUnavailableError } from '../errors';
1+
import { NoAppointmentsError, NoInformationError, InternalServerError, MissingElementError, InfiniteSpinnerError, UIError, NoResultsError, ConstructionWorkError, ServiceUnavailableError, UndisclosedError } from '../errors';
22

33
export const SESSION_FAILURE_EVENTS = [
44
NoAppointmentsError,
@@ -14,6 +14,7 @@ export const KNOWN_BUGS = [
1414
NoResultsError,
1515
InternalServerError,
1616
ServiceUnavailableError,
17+
UndisclosedError,
1718
InfiniteSpinnerError,
1819
MissingElementError,
1920
UIError,

src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Release from '../models/Release';
77
export const ENV = loadEnvironment();
88

99
export const MINIMUM_RELEASE = new Release(0, 0, 0);
10-
export const IGNORE_DAYS_WITH_EMPTY_BUCKETS = true;
10+
export const IGNORE_DAYS_WITH_EMPTY_BUCKETS = false;
1111

1212
export const HOMEPAGE_URL = 'http://otv.verwalt-berlin.de/';
1313

src/config/styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { PALETTE_HLS_12, PALETTE_MAGMA } from '../constants/styles';
1+
import { PALETTE_HLS_12, PALETTE_MAGMA, PALETTE_ROCKET_7 } from '../constants/styles';
22
import { Size } from '../types';
33

44
export const ERROR_PALETTE = PALETTE_HLS_12;
5-
export const WEEKDAY_PALETTE = PALETTE_MAGMA;
5+
export const WEEKDAY_PALETTE = PALETTE_ROCKET_7;
66

77
export const DEVICE_PIXEL_RATIO: number = 4; // Better image resolution for graphs
88
export const DEFAULT_GRAPH_SIZE: Size = {

src/constants/styles.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ export enum Color {
44
Gray = '#808080',
55
}
66

7+
export const PALETTE_ROCKET_7 = ['#30173a', '#611f53', '#971c5b', '#cb1b4f', '#ec4c3e', '#f58860', '#f6bc99'];
8+
export const PALETTE_SPECTRAL_7 = ['#dd4a4c', '#f98e52', '#fed481', '#ffffbe', '#d6ee9b', '#86cfa5', '#3d95b8'];
9+
export const PALETTE_MAGMA_7 = ['#1d1147', '#51127c', '#832681', '#b73779', '#e75263', '#fc8961', '#fec488'];
10+
export const PALETTE_VIRIDIS_12 = ['#481c6e', '#453581', '#3d4d8a', '#34618d', '#2b748e', '#24878e', '#1f998a', '#25ac82', '#40bd72', '#67cc5c', '#98d83e', '#cde11d'];
711
export const PALETTE_HLS_12 = ['#db5f57', '#dba157', '#d3db57', '#91db57', '#57db5f', '#57dba1', '#57d3db', '#5791db', '#5f57db', '#a157db', '#db57d3', '#db5791'];
12+
813
export const PALETTE_HLS_8_CUSTOM = ['#db5f57', '#febb81', '#91db57', '#57d3db', '#a157db', '#db57b2', Color.Gray, Color.Black];
914
export const PALETTE_HLS_8 = ['#db5f57', '#dbc257', '#91db57', '#57db80', '#57d3db', '#5770db', '#a157db', '#db57b2'];
1015
export const PALETTE_ROCKET = [Color.Gray, '#35193e', '#701f57', '#ad1759', '#e13342', '#f37651', '#f6b48f'];

src/errors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export class ServiceUnavailableError extends Error {
3333
public name = 'ServiceUnavailableError';
3434
}
3535

36+
export class UndisclosedError extends Error {
37+
public name = 'UndisclosedError';
38+
}
39+
3640
export class ConstructionWorkError extends Error {
3741
public name = 'ConstructionWorkError';
3842
}

src/models/pages/Page.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@ import { By } from 'selenium-webdriver';
22
import logger from '../../logger';
33
import Bot from '../bots/Bot';
44
import { INFINITE_TIME, SHORT_TIME } from '../../constants/times';
5-
import { InfiniteSpinnerError, InternalServerError, ServiceUnavailableError, TimeoutError } from '../../errors';
5+
import { InfiniteSpinnerError, InternalServerError, ServiceUnavailableError, TimeoutError, UndisclosedError } from '../../errors';
66
import { SCREENSHOTS_DIR } from '../../config/file';
77
import { PACKAGE_VERSION } from '../../constants';
88

99
const TEXTS = {
1010
InternalServerError: '500 - Internal Server Error',
1111
ServiceUnavailable: '503 Service Unavailable',
12+
UndisclosedError: 'Fehler ist aufgetreten',
1213
Home: 'Startseite',
1314
};
1415

1516
const ELEMENTS = {
1617
Errors: {
1718
InternalServerError: By.xpath(`//body[contains(text(), '${TEXTS.InternalServerError}')]`),
1819
ServiceUnavailable: By.xpath(`//body[contains(text(), '${TEXTS.ServiceUnavailable}')]`),
20+
UndisclosedError: By.xpath(`//body//*[contains(text(), '${TEXTS.UndisclosedError}')]`),
1921
},
2022
Buttons: {
2123
Home: By.xpath(`//a[@title=${TEXTS.Home}]`),
@@ -74,6 +76,10 @@ abstract class Page {
7476
throw new ServiceUnavailableError();
7577
}
7678

79+
if (await this.hasElement(ELEMENTS.Errors.UndisclosedError)) {
80+
throw new UndisclosedError();
81+
}
82+
7783
await this.doWaitUntilLoaded();
7884

7985
logger.debug('Page loaded.');

0 commit comments

Comments
 (0)