Skip to content
Snippets Groups Projects
Commit 9433d037 authored by Rakib Hasan's avatar Rakib Hasan
Browse files

Removed try clause from create action in status controller

Using catch statement in api_controller.rb to catch NotPermitted
Exception, and render error message
parent 87a6bed9
No related branches found
No related tags found
No related merge requests found
......@@ -62,16 +62,11 @@ class Api::V1::StatusesController < ApiController
end
def create
begin
@status = PostStatusService.new.call(current_user.account, params[:status], params[:in_reply_to_id].blank? ? nil : Status.find(params[:in_reply_to_id]), media_ids: params[:media_ids],
sensitive: params[:sensitive],
spoiler_text: params[:spoiler_text],
visibility: params[:visibility],
application: doorkeeper_token.application)
rescue Mastodon::NotPermitted => e
render json: {error: e.message}, status: 422
return
end
render action: :show
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment