V
V
vadimstroganov2015-10-24 02:51:29
Ruby on Rails
vadimstroganov, 2015-10-24 02:51:29

How to make 401 exception?

Hello!
Faced a problem, you need the server to give 401 and 500 errors in json
with 500 coped:

rescue_from Exception do
    # render json ...
end

But Rails doesn't know anything about 401 errors? How to handle 401 error like 500?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikiforov, 2015-10-24
@eoffsock

Do you need to render JSON with a 401 code?
render json, status: 401

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question