Capture crash reports and upload them the next time Zed launches
This commit is contained in:
parent
39c7b1fd51
commit
09a8b8e675
5 changed files with 149 additions and 25 deletions
|
@ -16,6 +16,7 @@ use axum::{
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use tower::ServiceBuilder;
|
||||
use tracing::instrument;
|
||||
|
||||
pub fn routes(state: Arc<AppState>) -> Router<Body> {
|
||||
Router::new()
|
||||
|
@ -25,6 +26,7 @@ pub fn routes(state: Arc<AppState>) -> Router<Body> {
|
|||
put(update_user).delete(destroy_user).get(get_user),
|
||||
)
|
||||
.route("/users/:id/access_tokens", post(create_access_token))
|
||||
.route("/crash", post(trace_crash))
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
.layer(Extension(state))
|
||||
|
@ -129,6 +131,18 @@ async fn get_user(
|
|||
Ok(Json(user))
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Crash {
|
||||
version: String,
|
||||
text: String,
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn trace_crash(crash: Json<Crash>) -> Result<()> {
|
||||
tracing::error!(version = %crash.version, text = %crash.text, "crash report");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct CreateAccessTokenQueryParams {
|
||||
public_key: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue