[API] Inconsistent error message when deleting a tag

When trying to delete a non-existent topic with the API, I get this (somewhat) understandable error:

status=403
content={"errors":["You are not permitted to view the requested resource."], 
    "error_type":"invalid_access"}

When trying to delete a non-existent tag, I get this:

status=500 
content=NoMethodError in TagsController#destroy - 
    undefined method `destroy' for nil:NilClass
5 Likes

API can be better here, #pr-welcome for that.

5 Likes

I’ll take a stab at fixing this.

3 Likes

Link to my fix: FIX: response error when deleting non-existent tags by ecdemis123 · Pull Request #5213 · discourse/discourse · GitHub

5 Likes

^ PR has been merged on Oct 2 :allthethings:

5 Likes