Skip to content

Commit

Permalink
"nonsense request" -> "return error"
Browse files Browse the repository at this point in the history
  • Loading branch information
sodiboo committed Apr 15, 2024
1 parent 29439eb commit e90ad0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions niri-ipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pub use socket::{NiriSocket, SOCKET_PATH_ENV};
/// Request from client to niri.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum Request {
/// Always responds with an error.
Nonsense,
/// Always responds with an error. (For testing error handling)
ReturnError,
/// Request the version string for the running niri instance.
Version,
/// Request information about connected outputs.
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
}

let request = match &msg {
Msg::Nonsense => Request::Nonsense,
Msg::Nonsense => Request::ReturnError,
Msg::Version => Request::Version,
Msg::Outputs => Request::Outputs,
Msg::FocusedWindow => Request::FocusedWindow,
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async fn handle_client(ctx: ClientCtx, stream: Async<'_, UnixStream>) -> anyhow:

fn process(ctx: &ClientCtx, request: Request) -> Reply {
let response = match request {
Request::Nonsense => return Err("nonsense request".into()),
Request::ReturnError => return Err("client wanted an error".into()),
Request::Version => Response::Version(version()),
Request::Outputs => {
let ipc_outputs = ctx.ipc_outputs.lock().unwrap().clone();
Expand Down

0 comments on commit e90ad0b

Please sign in to comment.