@@ -22,8 +22,9 @@ impl Display for FatalError {
2222 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
2323 match self {
2424 FatalError :: Connection ( e) => e. fmt ( f) ,
25- // TODO: better errors
26- FatalError :: SendMainThread => f. write_str ( "SendMainThread" ) ,
25+ FatalError :: SendMainThread => {
26+ f. write_str ( "Failed to send callback from X11 thread to main thread" )
27+ }
2728 }
2829 }
2930}
@@ -51,7 +52,7 @@ pub enum Error {
5152 Connect ( ConnectError ) ,
5253 DisplayOpenFailed ( DisplayOpenFailedError ) ,
5354 Handler ( HandlerError ) ,
54- Channel ( RecvError ) ,
55+ MainThreadRecvResult ,
5556 Calloop ( calloop:: Error ) ,
5657 RequestFromMainThreadFailed ( RequestFailed ) ,
5758 #[ cfg( feature = "opengl" ) ]
@@ -65,7 +66,26 @@ impl Display for Error {
6566 match self {
6667 Error :: Io ( e) => e. fmt ( f) ,
6768 Self :: IdsExhausted => f. write_str ( "X11 IDs have been exhausted" ) ,
68- _ => todo ! ( ) ,
69+ Error :: CreationFailed ( e) => write ! ( f, "Failed to create window: {e}" ) ,
70+ Error :: Run ( e) => write ! ( f, "Error in running X11 thread: {e}" ) ,
71+ Error :: DylibOpen ( e) => e. fmt ( f) ,
72+ Error :: InitThreadsFailed ( e) => e. fmt ( f) ,
73+ Error :: X11 ( e) => write ! ( f, "X server replied with error: {e:?}" ) ,
74+ Error :: Connection ( e) => e. fmt ( f) ,
75+ Error :: Parse ( e) => e. fmt ( f) ,
76+ Error :: GetProperty ( e) => e. fmt ( f) ,
77+ Error :: Connect ( e) => e. fmt ( f) ,
78+ Error :: DisplayOpenFailed ( e) => e. fmt ( f) ,
79+ Error :: Handler ( e) => e. fmt ( f) ,
80+ Error :: MainThreadRecvResult => {
81+ f. write_str ( "Failed to receive Window creation response from X11 thread: channel was closed unexpectedly" )
82+ }
83+ Error :: Calloop ( e) => e. fmt ( f) ,
84+ Error :: RequestFromMainThreadFailed ( e) => e. fmt ( f) ,
85+ #[ cfg( feature = "opengl" ) ]
86+ Error :: XLib ( e) => e. fmt ( f) ,
87+ #[ cfg( feature = "opengl" ) ]
88+ Error :: Gl ( e) => e. fmt ( f) ,
6989 }
7090 }
7191}
@@ -74,7 +94,6 @@ impl std::error::Error for Error {
7494 fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
7595 match self {
7696 Error :: Io ( e) => Some ( e) ,
77- Error :: Channel ( e) => Some ( e) ,
7897 Error :: DylibOpen ( e) => Some ( e) ,
7998 Error :: Connect ( e) => Some ( e) ,
8099 Error :: Handler ( e) => Some ( e. source ( ) ) ,
@@ -133,12 +152,6 @@ impl From<calloop::Error> for Error {
133152 }
134153}
135154
136- impl From < RecvError > for Error {
137- fn from ( value : RecvError ) -> Self {
138- Self :: Channel ( value)
139- }
140- }
141-
142155impl From < RequestFailed > for Error {
143156 fn from ( value : RequestFailed ) -> Self {
144157 Self :: RequestFromMainThreadFailed ( value)
0 commit comments