mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	blueslip: Move BlueslipError into blueslip_stacktrace.ts.
Its existence is purely to add more context when displaying the stacktrace.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							591b800ba4
						
					
				
				
					commit
					8e3a6d17bd
				
			@@ -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);
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user