Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Exceptional Feedback with Clojure

Exceptional Feedback with Clojure

As presented to the Clojerks (PDX Clojure User's Group).

Howard M. Lewis Ship

April 02, 2015
Tweet

More Decks by Howard M. Lewis Ship

Other Decks in Programming

Transcript

  1. org.postgresql.util.PSQLException: ERROR: column ak.password_hasp does not exist Position: 109 at

    org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302) ~[postgresql-9.3-1100-jdbc41.jar:na] at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:174) ~[bonecp-0.8.0.RELEASE.jar:na] at clojure.java.jdbc$db_query_with_resultset$run_query_with_params__2406.invoke(jdbc.clj:786) ~[na:na] at clojure.java.jdbc$db_query_with_resultset.invoke(jdbc.clj:793) ~[na:na] at clojure.java.jdbc$query.doInvoke(jdbc.clj:828) ~[na:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyToHelper(AFn.java:156) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.RestFn.applyTo(RestFn.java:132) [clojure-1.7.0-alpha5.jar:na] at clojure.core$apply.invoke(core.clj:630) [clojure-1.7.0-alpha5.jar:na] at fan.resources.common$db_query$fn__17537.invoke(common.clj:306) ~[na:na] at fan.resources.common$wrap_jdbc.invoke(common.clj:285) ~[na:na] at fan.resources.common$db_query.doInvoke(common.clj:306) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at fan.auth.resources.api_keys$create_token$fn__23631.invoke(api_keys.clj:144) [na:na] at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:580) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:521) [clojure-1.7.0-alpha5.jar:na] at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:596) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at fan.auth.resources.api_keys$create_token.invoke(api_keys.clj:141) [na:na] at clojure.lang.AFn.applyToHelper(AFn.java:165) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.7.0-alpha5.jar:na] at clojure.core$apply.invoke(core.clj:626) [clojure-1.7.0-alpha5.jar:na] at io.aviso.rook.dispatcher$construct_namespace_table_entry$fn__11402.invoke(dispatcher.clj:437) [na:na] at fan.endpoint_tracking$operation_tracking_sync_wrapper$fn__17773$fn__17774.invoke(endpoint_tracking.clj:53) [na:na] at clojure.core.async$thread_call$fn__9309.invoke(async.clj:405) [na:na] at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0-alpha5.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31] fan.auth.resources.api_keys$create_token$fn__23631.invoke api_keys.clj:144
  2. at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31] at

    clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0-alpha5.jar:na] at clojure.core.async$thread_call$fn__9309.invoke(async.clj:405) [na:na] at fan.endpoint_tracking$operation_tracking_sync_wrapper$fn__17773$fn__17774.invoke(endpoint_tracking.clj:53) [na:na] at io.aviso.rook.dispatcher$construct_namespace_table_entry$fn__11402.invoke(dispatcher.clj:437) [na:na] at clojure.core$apply.invoke(core.clj:626) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyToHelper(AFn.java:165) [clojure-1.7.0-alpha5.jar:na] at fan.auth.resources.api_keys$create_token.invoke(api_keys.clj:141) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:596) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:521) [clojure-1.7.0-alpha5.jar:na] at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:580) [na:na] at fan.auth.resources.api_keys$create_token$fn__23631.invoke(api_keys.clj:144) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at fan.resources.common$db_query.doInvoke(common.clj:306) [na:na] at fan.resources.common$wrap_jdbc.invoke(common.clj:285) ~[na:na] at fan.resources.common$db_query$fn__17537.invoke(common.clj:306) ~[na:na] at clojure.core$apply.invoke(core.clj:630) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.RestFn.applyTo(RestFn.java:132) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyToHelper(AFn.java:156) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.7.0-alpha5.jar:na] at clojure.java.jdbc$query.doInvoke(jdbc.clj:828) ~[na:na] at clojure.java.jdbc$db_query_with_resultset.invoke(jdbc.clj:793) ~[na:na] at clojure.java.jdbc$db_query_with_resultset$run_query_with_params__2406.invoke(jdbc.clj:786) ~[na:na] at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:174) ~[bonecp-0.8.0.RELEASE.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) ~[postgresql-9.3-1100-jdbc41.jar:na] org.postgresql.util.PSQLException: ERROR: column ak.password_hasp does not exist Position: 109 TIME
  3. Omission at io.aviso.rook.dispatcher$construct_namespace_table_entry$fn__11402.invoke(dispatcher.clj:437) [na:na] at clojure.core$apply.invoke(core.clj:626) [clojure-1.7.0-alpha5.jar:na] at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.7.0-alpha5.jar:na]

    at clojure.lang.AFn.applyToHelper(AFn.java:165) [clojure-1.7.0-alpha5.jar:na] at fan.auth.resources.api_keys$create_token.invoke(api_keys.clj:141) [na:na] io.aviso.rook.dispatcher/construct-namespace-table-entry/fn clojure.core/apply … fan.auth.resources.api-keys/create-token
  4. Exception Properties org.postgresql.util.PSQLException: ERROR: column ak.password_hasp does not exist Position:

    109 SQLState: "42703" errorCode: 0 serverErrorMessage: #<ServerErrorMessage ERROR: column ak.password_hasp does not exist Position: 109>
  5. Columns java.lang.Thread.run Thread.java: 745 java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1142

    ... clojure.core.async/thread-call/fn async.clj: 405 fan.endpoint-tracking/operation-tracking-sync-wrapper/fn/fn endpoint_tracking.clj: 53 io.aviso.rook.dispatcher/construct-namespace-table-entry/fn dispatcher.clj: 437 clojure.core/apply core.clj: 626 ... fan.auth.resources.api-keys/create-token api_keys.clj: 141 ... clojure.java.jdbc/db-transaction* jdbc.clj: 596 ... clojure.java.jdbc/db-transaction* jdbc.clj: 580 fan.auth.resources.api-keys/create-token/fn api_keys.clj: 144 ... fan.resources.common/db-query common.clj: 306 fan.resources.common/wrap-jdbc common.clj: 285 fan.resources.common/db-query/fn common.clj: 306 clojure.core/apply core.clj: 630 ... clojure.java.jdbc/query jdbc.clj: 828 clojure.java.jdbc/db-query-with-resultset jdbc.clj: 793 clojure.java.jdbc/db-query-with-resultset/run-query-with-params jdbc.clj: 786 com.jolbox.bonecp.PreparedStatementHandle.executeQuery PreparedStatementHandle.java: 174 org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery AbstractJdbc2Statement.java: 302 org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags AbstractJdbc2Statement.java: 417 org.postgresql.jdbc2.AbstractJdbc2Statement.execute AbstractJdbc2Statement.java: 560 org.postgresql.core.v3.QueryExecutorImpl.execute QueryExecutorImpl.java: 255 org.postgresql.core.v3.QueryExecutorImpl.processResults QueryExecutorImpl.java: 1890 org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse QueryExecutorImpl.java: 2161 fan.auth.resources.api-keys/create-token/fn api_keys.clj: 144
  6. (track
 #(format "Compiling `%s' to JavaScript" file-path)
 (let [^Map result


    (rhino/invoke-javascript ["META-INF/twixt/coffee-script.js" "META-INF/twixt/invoke-coffeescript.js"]
 "compileCoffeeScriptSource"
 (-> asset :content utils/as-string)
 file-path
 file-name)]
 
 ;; The script returns an object with key "exception" or key "output":
 (when (.containsKey result "exception")
 (throw (RuntimeException. (extract-value result "exception"))))
 (-> asset
 (utils/create-compiled-asset "text/javascript" (extract-value result "output") nil)
 (utils/add-attachment "source.map" "application/json" (-> result (extract-value "sourceMap") utils/as-bytes))))) Evaluation deferred
  7. (let [logger (get-logger *ns*)] (binding [*operation-labels* (conj *operation-labels* label)] (try

    … (catch Throwable t (handle-checkpoint-exception logger t))))) logs and wraps as ex-info or rethrows
  8. No