You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we use this match pattern in our backend
let discord_message =
match db_third_party::discord::DiscordMessage::create(client,&payload).await{Ok(discord_message) => discord_message,Err(error) => {returnErr((StatusCode::INTERNAL_SERVER_ERROR,format!("Something went wrong when create discord message: {}",
error
),).into_response())}};
In order to reduce the overhead of coming up a variable name for Ok(), I purpose that we unify that as below
let discord_message =
match db_third_party::discord::DiscordMessage::create(client,&payload).await{Ok(result) => result,Err(error) => {returnErr((StatusCode::INTERNAL_SERVER_ERROR,format!("Something went wrong when create discord message: {}",
error
),).into_response())}};
Instead of coming up a new name, we use result
The text was updated successfully, but these errors were encountered:
EiffelFly
changed the title
chore: refactor how we use match
chore: when use match pattern, we use result as variable name in the success path
Feb 13, 2023
Context
Currently, we use this match pattern in our backend
In order to reduce the overhead of coming up a variable name for Ok(), I purpose that we unify that as below
Instead of coming up a new name, we use
result
The text was updated successfully, but these errors were encountered: