Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Handle duplicate route API error #519

Closed
EverlastingBugstopper opened this issue Sep 4, 2019 · 2 comments · Fixed by #813
Closed

Handle duplicate route API error #519

EverlastingBugstopper opened this issue Sep 4, 2019 · 2 comments · Fixed by #813
Labels
feature Feature requests and suggestions good first issue Good for newcomers
Milestone

Comments

@EverlastingBugstopper
Copy link
Contributor

💡 Feature request

Overview and problem statement

When pushing a worker with a different name to a route that already exists, the Cloudflare Workers API returns an error. Wrangler should handle this error gracefully, and not print the raw API response.

Basic example

To reproduce, create a worker named worker, change your route to myzone.com/test run wrangler publish. Then change the name in your toml to worker-test and run wrangler publish again. You should see this:

Error: ⚠️  There was an error creating your route.
 Status Code: 409 Conflict
 Msg: {
  "result": null,
  "success": false,
  "errors": [
    {
      "code": 10020,
      "message": "workers.api.error.duplicate_route"
    }
  ],
  "messages": []
}

It'd be nicer if we had a map of status codes/API messages to more user friendly messages.

@EverlastingBugstopper EverlastingBugstopper added user report feature Feature requests and suggestions good first issue Good for newcomers and removed user report labels Sep 4, 2019
@pradovic
Copy link
Contributor

pradovic commented Oct 26, 2019

Hi,

Is the issue to map all status codes/API messages to more user friendly message, or just to handle workers.api.error.duplicate_route for now? If so, here is the trivial fix attempt: #813. Would be happy to change it, or do more, if needed.

@ashleymichal
Copy link
Contributor

hey @saran19 thanks for the update! This issue is closed, and while it looks related, the error you are reporting is actually separate. can you please file a new bug issue with your case?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests and suggestions good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants