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

Fix: Errors in Create WorkSpace and Create API Key Processes #785

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

anirbanpaulcom
Copy link
Contributor

Fixing:

Screencast.from.16-04-24.12.09.16.PM.IST.webm
Screencast.from.16-04-24.01.11.46.PM.IST.webm

Copy link

vercel bot commented Apr 16, 2024

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

A member of the Team first needs to authorize it.

@anirbanpaulcom
Copy link
Contributor Author

@steven-tey , @devkiran , Please take a look.Thank you!

apps/web/app/api/user/tokens/route.ts Outdated Show resolved Hide resolved
apps/web/app/api/user/tokens/route.ts Outdated Show resolved Hide resolved
apps/web/app/api/user/tokens/route.ts Outdated Show resolved Hide resolved
errorResponse.error.message ||
errorResponse ||
"Something went wrong",
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious about when errorResponse is a string and when it's an object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if we do this?

              let errorResponse = await res.json();
              if (errorResponse.error.message) {
                toast.error(errorResponse.error.message);
              } else {
                errorResponse = await res.text();
                toast.error(errorResponse || "Something went wrong");
              }
            }

Copy link
Collaborator

Choose a reason for hiding this comment

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

@anirbanpaulcom In which case does the API return text vs JSON? Can you clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting a text error response for Zod's error.

@devkiran
Copy link
Collaborator

@anirbanpaulcom can you resolve the conflicts?

@anirbanpaulcom
Copy link
Contributor Author

@anirbanpaulcom can you resolve the conflicts?

@devkiran, Done.

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.

None yet

2 participants