uncaught exception - handle uncaught_exception in clojure -


i have clojure endpoint in project updates document in couchdb.

(^{put true         path "/{id}"         produces ["application/json"]         consumes ["application/json"]         apioperation {:value "update" :notes ""}        }       method_name [this                       ^{pathparam "id"} id                       body]       (require 'com.xx.x.xx.xx.xx-response)       (let [doc (json/read-json body)]         (if-let [valid-doc (validate doc)]           (try+            (->>             (assoc valid-doc :modificationdate (utilities/getcurrentdate))             (couch/update-document dbs/xx-db)             (core/ok-response))            (catch java.io.ioexception ex                (log/error "line num 197")             )            (catch java.lang.exception ex              (log/error "line num 200")))  )))

this endpoint throws 500 uncaught exception when there document conflict along cause of exception , gets logged in log files. trace-redirects has sensitive information. added catch block handle exception [clojure.lang.exceptioninfo]. didn't work.

how handle this? there way remove trace-redirects?

request exception uncaught_exception status 500 message exception thrown not handled application or provider. clojure.lang.exceptioninfo: throw+: {:trace-redirects ["https://abc123xyz-dev:separate settled first deal@abc123xyz-dev.cloudant.com/1111"], :request-time 3899, :request {:path "/sss", :protocol "https", :scheme :https, :data nil, :http-url "https://abc123xyz-dev.cloudant.com/1111", :conn-timeout 6000, :host "abc123xyz-dev.cloudant.com", :follow-redirects true, :request-method :post, :query-string nil, :save-request? true, :anchor nil, :http-req #<httppost post https://abc123xyz-dev.cloudant.com/1111 http/1.1>, :as :json, :uri "/1111", :port -1, :username "abc123xyz-dev", :data-length nil, :server-name "abc123xyz-dev.cloudant.com", :headers {"authorization" "basic bgl2zw1vy2hhlwrldjpzzxxbhcmf0zsbzzxr0bgvki1zpcnn0igrly111ww=", "accept-encoding" "gzip, deflate", "content-type" "application/json", "user-agent" "com.ashafa.clutch/0.3.0", "accept" "*/*"}, :socket-timeout 6000, :body-type nil, :server-port nil, :query nil, :password "90t!@"}, :status 400, :headers {"server" "couchdb/1.0.2 (erlang otp/r14b)", "strict-transport-security" "max-age=31536000", "x-couch-request-id" "119df05d59", "content-type" "text/plain;charset=utf-8", "date" "thu, 18 jun 2015 17:46:08 gmt", "cache-control" "must-revalidate", "x-content-type-options" "nosniff;", "content-length" "54", "connection" "close"}, :body "{\"error\":\"bad_request\",\"reason\":\"invalid utf-8 json\"}\n"} 

update: apologies. error occurs when valid json posted update. sorry if misleading.

  • thanks

it looks need try block higher if want catch exceptions thrown when reading or validating json.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -