Skip to content

Commit

Permalink
Fix issue with fetching users in seed script (zed-industries#16393)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A
  • Loading branch information
JosephTLyons authored Aug 17, 2024
1 parent 18f0626 commit ebecd7e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/collab/src/seed.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::db::{self, ChannelRole, NewUserParams};

use anyhow::Context;
use chrono::{DateTime, Utc};
use db::Database;
use serde::{de::DeserializeOwned, Deserialize};
use std::{fmt::Write, fs, path::Path};
Expand All @@ -13,7 +12,6 @@ struct GitHubUser {
id: i32,
login: String,
email: Option<String>,
created_at: DateTime<Utc>,
}

#[derive(Deserialize)]
Expand Down Expand Up @@ -131,7 +129,7 @@ pub async fn seed(config: &Config, db: &Database, force: bool) -> anyhow::Result
&github_user.login,
Some(github_user.id),
github_user.email.as_deref(),
Some(github_user.created_at),
None,
None,
)
.await
Expand Down Expand Up @@ -161,9 +159,9 @@ async fn fetch_github<T: DeserializeOwned>(client: &reqwest::Client, url: &str)
.header("user-agent", "zed")
.send()
.await
.unwrap_or_else(|_| panic!("failed to fetch '{url}'"));
.unwrap_or_else(|error| panic!("failed to fetch '{url}': {error}"));
response
.json()
.await
.unwrap_or_else(|_| panic!("failed to deserialize github user from '{url}'"))
.unwrap_or_else(|error| panic!("failed to deserialize github user from '{url}': {error}"))
}

0 comments on commit ebecd7e

Please sign in to comment.