message: Handle temporary dir errors correctly
diff: @@ -238,13 +238,16 @@ impl Session {
  // named one in a temporary directory, and return it through the
  // responder. This is currently hamstrung since `bincode` does not
  // allow retrieving the inner writer from its serializer.
  - let tempdir = tempfile::tempdir().expect("FIXME");
  + match tempfile::tempdir() {
  + Ok(tempdir) => {
  let tempfile_path = tempdir.path().join("queue-dump");
  match fs::File::create(&tempfile_path) {
  Ok(tmp) => {
  effect_builder
  - .diagnostics_port_dump_queue(self.create_queue_dump_format(tmp))
  + .diagnostics_port_dump_queue(
  + self.create_queue_dump_format(tmp),
  + )
  .await;
  // We can now reopen the file and send it.
  @@ -256,12 +259,14 @@ impl Session {
  )
  .await?;
  - // At this point, we have a complete queue dump in the
  - // requested format stored inside the temporary file.
  + // At this point, we have a complete queue dump in
  + // the requested format stored inside the temporary
  + // file.
  let mut tokio_file =
  tokio::fs::File::from_std(reopened_tempfile);
  - self.stream_to_client(writer, &mut tokio_file).await?;
  + self.stream_to_client(writer, &mut tokio_file)
  + .await?;
  }
  Err(err) => {
  self.send_outcome(
  @@ -287,6 +292,18 @@ impl Session {
  }
  };
  }
  + Err(err) => {
  + self.send_outcome(
  + writer,
  + &Outcome::failed(format!(
  + "could not create a temporary directory for queue dump: {}",
  + err
  + )),
  + )
  + .await?;
  + }
  + }
  + }
  Action::Quit => {
  self.send_outcome(writer, &Outcome::success("goodbye!"))
  .await?;
  