Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Added Vercel API error handling #3826

Conversation

NicholasLYang
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Feb 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-kitchensink-blog 🔄 Building (Inspect) Feb 15, 2023 at 11:01PM (UTC)
8 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)
examples-vite-web ⬜️ Ignored (Inspect) Feb 15, 2023 at 11:01PM (UTC)

@vercel
Copy link

vercel bot commented Feb 15, 2023

@NicholasLYang is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm learning Rust, but I don't see anything glaring here!

pub struct CachingStatusResponse {
pub status: CachingStatus,
#[serde(rename_all = "lowercase")]
pub enum CachingStatusResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these _Response enums feel like they should be Result<CachingStatus, APIError>. Could write our own version of Response::error_for_status that checks that status code and if it's an error we deserialize to the APIError message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure. It's a little frustrating because the field for the valid path isn't a consistent one like { "ok": {...} } but varies depending on the resource. Hence the redundant enums

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there's a way we can do this generically? I could make a macro ofc but I don't think that's worth it.

@NicholasLYang
Copy link
Contributor Author

Closed in favor of #3898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants