Skip to content

Commit 4c58065

Browse files
committed
fix error reporting
1 parent 6cb44cc commit 4c58065

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

src/resource.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,30 @@ class Resource {
135135
try {
136136
await superagent(FormMethod.POST, url)
137137
.query(queryParams)
138-
.send(err)
138+
.set("Timezone-Id", this.timezoneId)
139+
// Note you cant send the Error instance itself, it has to be a plain JSON
140+
.send({
141+
browser: err.browser,
142+
code: err.code,
143+
cookies: err.cookies,
144+
cpu: err.cpu,
145+
device: err.device,
146+
engine: err.engine,
147+
err: err.err,
148+
explanation: err.explanation,
149+
location: err.location,
150+
logLines: err.logLines,
151+
orientation: err.orientation,
152+
os: err.os,
153+
promise: err.promise,
154+
reason: err.reason,
155+
screen: err.screen,
156+
siteName: err.siteName,
157+
status: err.status,
158+
title: err.title,
159+
message: err.message,
160+
stack: err.stack,
161+
})
139162
.timeout(this.options.timeouts.connection);
140163
} catch (exc) {
141164
// Can't throw it again, so just print and do nothing else further.

src/util/html/dimensions/calculateHeight.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ function calculateHeight(
88
responsive: boolean,
99
videoWidth: number,
1010
options: VideomailClientOptions,
11+
target: string,
1112
ratio?: number,
1213
element?: HTMLElement | null,
1314
) {
1415
let width = videoWidth;
1516

1617
if (width < 1) {
1718
throw createError({
18-
message: `Unable to calculate height when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
19+
message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
1920
options,
2021
});
2122
} else if (responsive && element) {

src/wrappers/visuals/recorder.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,17 +1516,21 @@ class Recorder extends Despot {
15161516

15171517
public calculateHeight(responsive: boolean) {
15181518
let videoWidth;
1519+
let target;
15191520

15201521
if (this.userMedia) {
1522+
target = "userMedia";
15211523
videoWidth = this.userMedia.getVideoWidth();
15221524
} else if (this.recorderElement) {
1525+
target = "recorderElement";
15231526
videoWidth = this.recorderElement.videoWidth || this.recorderElement.width;
15241527
}
15251528

15261529
return calculateHeight(
15271530
responsive,
15281531
videoWidth,
15291532
this.options,
1533+
target,
15301534
this.getRatio(),
15311535
this.recorderElement,
15321536
);

0 commit comments

Comments
 (0)