Commit a304b0834a
Unsigned
Layout: unified · split
src/server.rs +14 −4
| @@ -252,7 +252,7 @@ impl MatrixServer { | |||
| 252 | self.print_error(&format!( | 252 | self.print_error(&format!( |
| 253 | "Failed to join {}: {}", | 253 | "Failed to join {}: {}", |
| 254 | target, | 254 | target, |
| 255 | format_join_error(&error) | 255 | format_join_error(&error, &target) |
| 256 | )); | 256 | )); |
| 257 | } | 257 | } |
| 258 | } | 258 | } |
| @@ -462,11 +462,21 @@ impl MatrixServer { | |||
| 462 | } | 462 | } |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | fn format_join_error(error: &Error) -> String { | 465 | fn format_join_error(error: &Error, target: &str) -> String { |
| 466 | error | 466 | let message = error |
| 467 | .as_client_api_error() | 467 | .as_client_api_error() |
| 468 | .map(ToString::to_string) | 468 | .map(ToString::to_string) |
| 469 | .unwrap_or_else(|| error.to_string()) | 469 | .unwrap_or_else(|| error.to_string()); |
| 470 | |||
| 471 | if target.starts_with('#') | ||
| 472 | && message.contains("Expected RoomID of the form") | ||
| 473 | { | ||
| 474 | format!( | ||
| 475 | "{message}; the alias may point to a room v12 ID without a server part. Update the homeserver/client stack or join from a homeserver that supports room v12." | ||
| 476 | ) | ||
| 477 | } else { | ||
| 478 | message | ||
| 479 | } | ||
| 470 | } | 480 | } |
| 471 | 481 | ||
| 472 | impl Drop for MatrixServer { | 482 | impl Drop for MatrixServer { |