Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error responses wait for stacktrace before printing to repl output #2355

Closed
RobWood8426 opened this issue Nov 22, 2023 · 0 comments
Closed

Comments

@RobWood8426
Copy link
Contributor

RobWood8426 commented Nov 22, 2023

Repl-Exception-Issue.mov-processed.mp4

When an exception is thrown in the repl you need to wait for the stack trace before it will print.
This is an issue when the stack trace takes long to resolve.

{
  id: '10',
  op: 'eval',
  ns: 'user',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  code: '(/ 1 0)',
  'nrepl.middleware.print/options': { 'right-margin': 80, length: 50, level: 10 },
  'nrepl.middleware.print/print': 'cider.nrepl.pprint/pprint',
  file: '/Users/robertwood/storage/web-server/.calva/output-window/output.calva-repl',
  line: 109,
  column: 1,
  stdout: [Function: stdout],
  stderr: [Function: stderr],
  pprint: true
}
1700658214998 <- received 6ms
{
  err: 'Execution error (ArithmeticException) at user/eval116977 (REPL:109).\n' +
    'Divide by zero\n',
  id: '10',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e'
}
1700658214998 <- received 0ms
{
  ex: 'class java.lang.ArithmeticException',
  id: '10',
  'root-ex': 'class java.lang.ArithmeticException',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  status: [ 'eval-error' ]
}
1700658214998 <- received 0ms
{
  id: '10',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  status: [ 'done' ]
}
1700658214998 -> sent 
{
  op: 'stacktrace',
  id: '11',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e'
}
1700658215321 <- received 323ms
{
  'changed-namespaces': {},
  id: '10',
  'repl-type': 'clj',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  status: [ 'state' ]
}
1700658239939 <- received 24941ms
{
  class: 'java.lang.ArithmeticException',
  id: '11',
  message: 'Divide by zero',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  stacktrace: [
    {
      class: 'clojure.lang.Numbers',
      file: 'Numbers.java',
      'file-url': [],
      flags: [Array],
      line: 190,
      method: 'divide',
      name: 'clojure.lang.Numbers/divide',
      type: 'java'
    },
    {
      class: 'clojure.lang.Numbers',
      file: 'Numbers.java',
      'file-url': [],
      flags: [Array],
      line: 3911,
      method: 'divide',
      name: 'clojure.lang.Numbers/divide',
      type: 'java'
    },
    {
      class: 'user$eval116977',
      file: 'NO_SOURCE_FILE',
      'file-url': '',
      flags: [Array],
      fn: 'eval116977',
      line: 109,
      method: 'invokeStatic',
      name: 'user$eval116977/invokeStatic',
      ns: 'user',
      type: 'clj',
      var: 'user/eval116977'
    },
    {
      class: 'user$eval116977',
      file: 'NO_SOURCE_FILE',
      'file-url': '',
      flags: [Array],
      fn: 'eval116977',
      line: 109,
      method: 'invoke',
      name: 'user$eval116977/invoke',
      ns: 'user',
      type: 'clj',
      var: 'user/eval116977'
    },
    {
      class: 'clojure.lang.Compiler',
      file: 'Compiler.java',
      'file-url': [],
      flags: [Array],
      line: 7194,
      method: 'eval',
      name: 'clojure.lang.Compiler/eval',
      type: 'java'
    },
    {
      class: 'clojure.lang.Compiler',
      file: 'Compiler.java',
      'file-url': [],
      flags: [Array],
      line: 7149,
      method: 'eval',
      name: 'clojure.lang.Compiler/eval',
      type: 'java'
    },
    {
      class: 'clojure.core$eval',
      file: 'core.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj',
      flags: [Array],
      fn: 'eval',
      line: 3215,
      method: 'invokeStatic',
      name: 'clojure.core$eval/invokeStatic',
      ns: 'clojure.core',
      type: 'clj',
      var: 'clojure.core/eval'
    },
    {
      class: 'clojure.core$eval',
      file: 'core.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj',
      flags: [Array],
      fn: 'eval',
      line: 3211,
      method: 'invoke',
      name: 'clojure.core$eval/invoke',
      ns: 'clojure.core',
      type: 'clj',
      var: 'clojure.core/eval'
    },
    {
      class: 'nrepl.middleware.interruptible_eval$evaluate$fn__33605$fn__33606',
      file: 'interruptible_eval.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/interruptible_eval.clj',
      flags: [Array],
      fn: 'evaluate/fn/fn',
      line: 87,
      method: 'invoke',
      name: 'nrepl.middleware.interruptible_eval$evaluate$fn__33605$fn__33606/invoke',
      ns: 'nrepl.middleware.interruptible-eval',
      type: 'clj',
      var: 'nrepl.middleware.interruptible-eval/evaluate'
    },
    {
      class: 'clojure.lang.AFn',
      file: 'AFn.java',
      'file-url': [],
      flags: [Array],
      line: 152,
      method: 'applyToHelper',
      name: 'clojure.lang.AFn/applyToHelper',
      type: 'java'
    },
    {
      class: 'clojure.lang.AFn',
      file: 'AFn.java',
      'file-url': [],
      flags: [Array],
      line: 144,
      method: 'applyTo',
      name: 'clojure.lang.AFn/applyTo',
      type: 'java'
    },
    {
      class: 'clojure.core$apply',
      file: 'core.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj',
      flags: [Array],
      fn: 'apply',
      line: 667,
      method: 'invokeStatic',
      name: 'clojure.core$apply/invokeStatic',
      ns: 'clojure.core',
      type: 'clj',
      var: 'clojure.core/apply'
    },
    {
      class: 'clojure.core$with_bindings_STAR_',
      file: 'core.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj',
      flags: [Array],
      fn: 'with-bindings*',
      line: 1990,
      method: 'invokeStatic',
      name: 'clojure.core$with_bindings_STAR_/invokeStatic',
      ns: 'clojure.core',
      type: 'clj',
      var: 'clojure.core/with-bindings*'
    },
    {
      class: 'clojure.core$with_bindings_STAR_',
      file: 'core.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj',
      flags: [Array],
      fn: 'with-bindings*',
      line: 1990,
      method: 'doInvoke',
      name: 'clojure.core$with_bindings_STAR_/doInvoke',
      ns: 'clojure.core',
      type: 'clj',
      var: 'clojure.core/with-bindings*'
    },
    {
      class: 'clojure.lang.RestFn',
      file: 'RestFn.java',
      'file-url': [],
      flags: [Array],
      line: 425,
      method: 'invoke',
      name: 'clojure.lang.RestFn/invoke',
      type: 'java'
    },
    {
      class: 'nrepl.middleware.interruptible_eval$evaluate$fn__33605',
      file: 'interruptible_eval.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/interruptible_eval.clj',
      flags: [Array],
      fn: 'evaluate/fn',
      line: 87,
      method: 'invoke',
      name: 'nrepl.middleware.interruptible_eval$evaluate$fn__33605/invoke',
      ns: 'nrepl.middleware.interruptible-eval',
      type: 'clj',
      var: 'nrepl.middleware.interruptible-eval/evaluate'
    },
    {
      class: 'clojure.main$repl$read_eval_print__9206$fn__9209',
      file: 'main.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/main.clj',
      flags: [Array],
      fn: 'repl/read-eval-print/fn',
      line: 437,
      method: 'invoke',
      name: 'clojure.main$repl$read_eval_print__9206$fn__9209/invoke',
      ns: 'clojure.main',
      type: 'clj',
      var: 'clojure.main/repl'
    },
    {
      class: 'clojure.main$repl$read_eval_print__9206',
      file: 'main.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/main.clj',
      flags: [Array],
      fn: 'repl/read-eval-print',
      line: 437,
      method: 'invoke',
      name: 'clojure.main$repl$read_eval_print__9206/invoke',
      ns: 'clojure.main',
      type: 'clj',
      var: 'clojure.main/repl'
    },
    {
      class: 'clojure.main$repl$fn__9215',
      file: 'main.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/main.clj',
      flags: [Array],
      fn: 'repl/fn',
      line: 458,
      method: 'invoke',
      name: 'clojure.main$repl$fn__9215/invoke',
      ns: 'clojure.main',
      type: 'clj',
      var: 'clojure.main/repl'
    },
    {
      class: 'clojure.main$repl',
      file: 'main.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/main.clj',
      flags: [Array],
      fn: 'repl',
      line: 458,
      method: 'invokeStatic',
      name: 'clojure.main$repl/invokeStatic',
      ns: 'clojure.main',
      type: 'clj',
      var: 'clojure.main/repl'
    },
    {
      class: 'clojure.main$repl',
      file: 'main.clj',
      'file-url': 'jar:file:/root/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/main.clj',
      flags: [Array],
      fn: 'repl',
      line: 368,
      method: 'doInvoke',
      name: 'clojure.main$repl/doInvoke',
      ns: 'clojure.main',
      type: 'clj',
      var: 'clojure.main/repl'
    },
    {
      class: 'clojure.lang.RestFn',
      file: 'RestFn.java',
      'file-url': [],
      flags: [Array],
      line: 1523,
      method: 'invoke',
      name: 'clojure.lang.RestFn/invoke',
      type: 'java'
    },
    {
      class: 'nrepl.middleware.interruptible_eval$evaluate',
      file: 'interruptible_eval.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/interruptible_eval.clj',
      flags: [Array],
      fn: 'evaluate',
      line: 84,
      method: 'invokeStatic',
      name: 'nrepl.middleware.interruptible_eval$evaluate/invokeStatic',
      ns: 'nrepl.middleware.interruptible-eval',
      type: 'clj',
      var: 'nrepl.middleware.interruptible-eval/evaluate'
    },
    {
      class: 'nrepl.middleware.interruptible_eval$evaluate',
      file: 'interruptible_eval.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/interruptible_eval.clj',
      flags: [Array],
      fn: 'evaluate',
      line: 56,
      method: 'invoke',
      name: 'nrepl.middleware.interruptible_eval$evaluate/invoke',
      ns: 'nrepl.middleware.interruptible-eval',
      type: 'clj',
      var: 'nrepl.middleware.interruptible-eval/evaluate'
    },
    {
      class: 'nrepl.middleware.interruptible_eval$interruptible_eval$fn__33638$fn__33642',
      file: 'interruptible_eval.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/interruptible_eval.clj',
      flags: [Array],
      fn: 'interruptible-eval/fn/fn',
      line: 152,
      method: 'invoke',
      name: 'nrepl.middleware.interruptible_eval$interruptible_eval$fn__33638$fn__33642/invoke',
      ns: 'nrepl.middleware.interruptible-eval',
      type: 'clj',
      var: 'nrepl.middleware.interruptible-eval/interruptible-eval'
    },
    {
      class: 'clojure.lang.AFn',
      file: 'AFn.java',
      'file-url': [],
      flags: [Array],
      line: 22,
      method: 'run',
      name: 'clojure.lang.AFn/run',
      type: 'java'
    },
    {
      class: 'nrepl.middleware.session$session_exec$main_loop__33708$fn__33712',
      file: 'session.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/session.clj',
      flags: [Array],
      fn: 'session-exec/main-loop/fn',
      line: 218,
      method: 'invoke',
      name: 'nrepl.middleware.session$session_exec$main_loop__33708$fn__33712/invoke',
      ns: 'nrepl.middleware.session',
      type: 'clj',
      var: 'nrepl.middleware.session/session-exec'
    },
    {
      class: 'nrepl.middleware.session$session_exec$main_loop__33708',
      file: 'session.clj',
      'file-url': 'jar:file:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar!/nrepl/middleware/session.clj',
      flags: [Array],
      fn: 'session-exec/main-loop',
      line: 217,
      method: 'invoke',
      name: 'nrepl.middleware.session$session_exec$main_loop__33708/invoke',
      ns: 'nrepl.middleware.session',
      type: 'clj',
      var: 'nrepl.middleware.session/session-exec'
    },
    {
      class: 'clojure.lang.AFn',
      file: 'AFn.java',
      'file-url': [],
      flags: [Array],
      line: 22,
      method: 'run',
      name: 'clojure.lang.AFn/run',
      type: 'java'
    },
    {
      class: 'java.lang.Thread',
      file: 'Thread.java',
      'file-url': [],
      flags: [Array],
      line: 750,
      method: 'run',
      name: 'java.lang.Thread/run',
      type: 'java'
    }
  ]
}
1700658239942 <- received 3ms
{
  id: '11',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  status: [ 'done' ]
}
1700658239942 <- received 0ms
{
  id: '11',
  msg: 'The `stacktrace` op is deprecated, please use `analyze-last-stacktrace` instead.',
  session: 'edc9d13f-117d-4e7c-8946-66940524071e',
  status: [ 'notification' ],
  type: 'warning'
}
RobWood8426 added a commit to RobWood8426/calva that referenced this issue Nov 22, 2023
Seperate error print from stacktrace print

WIP Adressing issue BetterThanTomorrow#2355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant