moclojer icon indicating copy to clipboard operation
moclojer copied to clipboard

Error in webhook request

Open avelino opened this issue 9 months ago • 0 comments

example: http status code 500

If the webhook request returns a 500 error (any type of error that is not a success), is it the responsibility of the mock server to notify the user or not? If so, how should it be notified?

backtrace

Exception in thread "async-thread-macro-138" java.lang.ClassCastException: class clojure.lang.MapEntry cannot be cast to class java.lang.String (clojure.lang.MapEntry is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
 at clj_http.core$request.invokeStatic(core.clj:611)
 at clj_http.core$request.invoke(core.clj:546)
 at clj_http.core$request.invokeStatic(core.clj:547)
 at clj_http.core$request.invoke(core.clj:546)
 at clojure.lang.Var.invoke(Var.java:384)
 at clj_http.client$wrap_request_timing$fn__16870.invoke(client.clj:1083)
 at clj_http.headers$wrap_header_map$fn__15756.invoke(headers.clj:152)
 at clj_http.client$wrap_query_params$fn__16760.invoke(client.clj:817)
 at clj_http.client$wrap_basic_auth$fn__16766.invoke(client.clj:840)
 at clj_http.client$wrap_oauth$fn__16771.invoke(client.clj:857)
 at clj_http.client$wrap_user_info$fn__16780.invoke(client.clj:877)
 at clj_http.client$wrap_url$fn__16852.invoke(client.clj:1035)
 at clj_http.client$wrap_decompression$fn__16547.invoke(client.clj:416)
 at clj_http.client$wrap_input_coercion$fn__16672.invoke(client.clj:630)
 at clj_http.client$wrap_additional_header_parsing$fn__16697.invoke(client.clj:685)
 at clj_http.client$wrap_output_coercion$fn__16659.invoke(client.clj:574)
 at clj_http.client$wrap_exceptions$fn__16500.invoke(client.clj:250)
 at clj_http.client$wrap_accept$fn__16712.invoke(client.clj:728)
 at clj_http.client$wrap_accept_encoding$fn__16719.invoke(client.clj:750)
 at clj_http.client$wrap_content_type$fn__16706.invoke(client.clj:711)
 at clj_http.client$wrap_form_params$fn__16817.invoke(client.clj:959)
 at clj_http.client$wrap_nested_params$fn__16838.invoke(client.clj:993)
 at clj_http.client$wrap_flatten_nested_params$fn__16847.invoke(client.clj:1017)
 at clj_http.client$wrap_method$fn__16785.invoke(client.clj:893)
 at clj_http.cookies$wrap_cookies$fn__14963.invoke(cookies.clj:128)
 at clj_http.links$wrap_links$fn__16096.invoke(links.clj:63)
 at clj_http.client$wrap_unknown_host$fn__16855.invoke(client.clj:1046)
 at com.moclojer.webhook$request_after_delay$fn__16970$state_machine__10306__auto____16991$fn__16993$fn__16995.invoke(webhook.clj:24)
 at clojure.core.async$thread_call$fn__10557.invoke(async.clj:484)
 at clojure.lang.AFn.run(AFn.java:22)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 at java.base/java.lang.Thread.run(Thread.java:840)

solution

As the webhook request is made on a separate thread after the return of the HTTP API (in the background), the way we can notify of the error is by handling the error (backtrace) that we currently have is generating a log on stdout.

avelino avatar May 09 '24 02:05 avelino