blueslip: Move BlueslipError into blueslip_stacktrace.ts.

Its existence is purely to add more context when displaying the
stacktrace.
This commit is contained in:
Alex Vandiver
2023-04-28 21:05:20 +00:00
committed by Tim Abbott
parent 591b800ba4
commit 8e3a6d17bd
2 changed files with 13 additions and 13 deletions

View File

@@ -9,7 +9,7 @@
import * as Sentry from "@sentry/browser";
import $ from "jquery";
import * as blueslip_stacktrace from "./blueslip_stacktrace";
import {BlueslipError, display_stacktrace} from "./blueslip_stacktrace";
import {page_params} from "./page_params";
if (Error.stackTraceLimit !== undefined) {
@@ -86,17 +86,6 @@ export function warn(msg: string, more_info?: unknown): void {
}
}
class BlueslipError extends Error {
override name = "BlueslipError";
more_info?: object;
constructor(msg: string, more_info?: object | undefined, cause?: unknown | undefined) {
super(msg, {cause});
if (more_info !== undefined) {
this.more_info = more_info;
}
}
}
export function error(
msg: string,
more_info?: object | undefined,
@@ -136,6 +125,6 @@ if (page_params.development_environment) {
return;
}
void blueslip_stacktrace.display_stacktrace(ex);
void display_stacktrace(ex);
});
}

View File

@@ -5,6 +5,17 @@ import StackTraceGPS from "stacktrace-gps";
import render_blueslip_stacktrace from "../templates/blueslip_stacktrace.hbs";
export class BlueslipError extends Error {
override name = "BlueslipError";
more_info?: object;
constructor(msg: string, more_info?: object | undefined, cause?: unknown | undefined) {
super(msg, {cause});
if (more_info !== undefined) {
this.more_info = more_info;
}
}
}
type FunctionName = {
scope: string;
name: string;