@@ -8,7 +8,7 @@ use gpui::{App, SemanticVersion};
8
8
use http_client:: { self , HttpClient , HttpClientWithUrl , HttpRequestExt , Method } ;
9
9
use paths:: { crashes_dir, crashes_retired_dir} ;
10
10
use project:: Project ;
11
- use release_channel:: { ReleaseChannel , RELEASE_CHANNEL } ;
11
+ use release_channel:: { AppCommitSha , ReleaseChannel , RELEASE_CHANNEL } ;
12
12
use settings:: Settings ;
13
13
use smol:: stream:: StreamExt ;
14
14
use std:: {
@@ -25,6 +25,7 @@ static PANIC_COUNT: AtomicU32 = AtomicU32::new(0);
25
25
26
26
pub fn init_panic_hook (
27
27
app_version : SemanticVersion ,
28
+ app_commit_sha : Option < AppCommitSha > ,
28
29
system_id : Option < String > ,
29
30
installation_id : Option < String > ,
30
31
session_id : String ,
@@ -54,12 +55,22 @@ pub fn init_panic_hook(
54
55
let location = info. location ( ) . unwrap ( ) ;
55
56
let backtrace = Backtrace :: new ( ) ;
56
57
eprintln ! (
57
- "Thread {:?} panicked with {:?} at {}:{}:{}\n {:?}" ,
58
+ "Thread {:?} panicked with {:?} at {}:{}:{}\n {}{ :?}" ,
58
59
thread_name,
59
60
payload,
60
61
location. file( ) ,
61
62
location. line( ) ,
62
63
location. column( ) ,
64
+ match app_commit_sha. as_ref( ) {
65
+ Some ( commit_sha) => format!(
66
+ "https://github.com/zed-industries/zed/blob/{}/src/{}#L{} \
67
+ (may not be uploaded, line may be incorrect if files modified)\n ",
68
+ commit_sha. 0 ,
69
+ location. file( ) ,
70
+ location. line( )
71
+ ) ,
72
+ None => "" . to_string( ) ,
73
+ } ,
63
74
backtrace,
64
75
) ;
65
76
std:: process:: exit ( -1 ) ;
@@ -103,6 +114,7 @@ pub fn init_panic_hook(
103
114
line : location. line ( ) ,
104
115
} ) ,
105
116
app_version : app_version. to_string ( ) ,
117
+ app_commit_sha : app_commit_sha. as_ref ( ) . map ( |sha| sha. 0 . clone ( ) ) ,
106
118
release_channel : RELEASE_CHANNEL . dev_name ( ) . into ( ) ,
107
119
target : env ! ( "TARGET" ) . to_owned ( ) . into ( ) ,
108
120
os_name : telemetry:: os_name ( ) ,
0 commit comments