Skip to content

Commit

Permalink
fix error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
binarykitchen committed Nov 23, 2024
1 parent 6cb44cc commit 4c58065
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
25 changes: 24 additions & 1 deletion src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,30 @@ class Resource {
try {
await superagent(FormMethod.POST, url)
.query(queryParams)
.send(err)
.set("Timezone-Id", this.timezoneId)
// Note you cant send the Error instance itself, it has to be a plain JSON
.send({
browser: err.browser,
code: err.code,
cookies: err.cookies,
cpu: err.cpu,
device: err.device,
engine: err.engine,
err: err.err,
explanation: err.explanation,
location: err.location,
logLines: err.logLines,
orientation: err.orientation,
os: err.os,
promise: err.promise,
reason: err.reason,
screen: err.screen,
siteName: err.siteName,
status: err.status,
title: err.title,
message: err.message,
stack: err.stack,
})
.timeout(this.options.timeouts.connection);
} catch (exc) {
// Can't throw it again, so just print and do nothing else further.
Expand Down
3 changes: 2 additions & 1 deletion src/util/html/dimensions/calculateHeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ function calculateHeight(
responsive: boolean,
videoWidth: number,
options: VideomailClientOptions,
target: string,
ratio?: number,
element?: HTMLElement | null,
) {
let width = videoWidth;

if (width < 1) {
throw createError({
message: `Unable to calculate height when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
options,
});
} else if (responsive && element) {
Expand Down
4 changes: 4 additions & 0 deletions src/wrappers/visuals/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1516,17 +1516,21 @@ class Recorder extends Despot {

public calculateHeight(responsive: boolean) {
let videoWidth;
let target;

if (this.userMedia) {
target = "userMedia";
videoWidth = this.userMedia.getVideoWidth();
} else if (this.recorderElement) {
target = "recorderElement";
videoWidth = this.recorderElement.videoWidth || this.recorderElement.width;
}

return calculateHeight(
responsive,
videoWidth,
this.options,
target,
this.getRatio(),
this.recorderElement,
);
Expand Down

0 comments on commit 4c58065

Please sign in to comment.