You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "shreemaan-abhishek (via GitHub)" <gi...@apache.org> on 2023/05/30 06:17:54 UTC

[GitHub] [apisix] shreemaan-abhishek opened a new pull request, #9574: chore: return concise error when invalid resource is used

shreemaan-abhishek opened a new pull request, #9574:
URL: https://github.com/apache/apisix/pull/9574

   ### Description
   
   When user tries to create an invalid resource using the admin API, the error response is not clear.
   
   #### Existing situation:
   
   <img width="795" alt="image" src="https://github.com/apache/apisix/assets/61597896/836b5205-309b-47a9-b336-942ba3ae5c53">
   
   #### Proposed:
   
   <img width="783" alt="image" src="https://github.com/apache/apisix/assets/61597896/3858a6f4-5fa6-41f6-976f-7bbf51c7d3a0">
   
   Fixes #9569
   
   ref: https://github.com/apache/apisix/issues/9569#issuecomment-1567654262
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on pull request #9574: refactor: return concise error when invalid resource is used

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on PR #9574:
URL: https://github.com/apache/apisix/pull/9574#issuecomment-1569400891

   Could you add a test case?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 merged pull request #9574: refactor: return concise error when invalid resource is used

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 merged PR #9574:
URL: https://github.com/apache/apisix/pull/9574


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #9574: refactor: return concise error when invalid resource is used

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on code in PR #9574:
URL: https://github.com/apache/apisix/pull/9574#discussion_r1219283086


##########
apisix/admin/init.lua:
##########
@@ -176,7 +176,7 @@ local function run()
 
     local resource = resources[seg_res]
     if not resource then
-        core.response.exit(404, {error_msg = "not found"})
+        core.response.exit(404, {error_msg = "resource: '".. seg_res .. "' is not supported"})

Review Comment:
   Unsupported resource type: ‘routs’.
   Is this better?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on a diff in pull request #9574: refactor: return concise error when invalid resource is used

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on code in PR #9574:
URL: https://github.com/apache/apisix/pull/9574#discussion_r1219698136


##########
apisix/admin/init.lua:
##########
@@ -176,7 +176,7 @@ local function run()
 
     local resource = resources[seg_res]
     if not resource then
-        core.response.exit(404, {error_msg = "not found"})
+        core.response.exit(404, {error_msg = "resource: '".. seg_res .. "' is not supported"})

Review Comment:
   yep, just pushed the changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org