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

MAINT: wrote API errors to console. #1060

Closed
wants to merge 1 commit into from

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Nov 8, 2022

Sending the error to the frontend does not preclude to writing it to the console. When the frontend does not work the error is logged nowhere, and therefore having it persisted in the log can be helpful.

Sending the error to the frontend does not preclude to writing it to the
console. When the frontend does not work the error is logged nowhere,
and therefore having it persisted in the log can be helpful.
@blink1073
Copy link
Contributor

As far as I can tell we're already logging tracebacks for API errors:

With this change (I had to change exec_info -> exc_info:

[E 2022-11-10 12:24:31.113 ServerApp] Uncaught exception POST /api/sessions?1668104671111 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions?1668104671111', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/Users/silvester/workspace/.venvs/jupyter_server/lib/python3.10/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
      File "/Users/silvester/workspace/jupyter_server/jupyter_server/services/sessions/handlers.py", line 55, in post
        raise ValueError('what')
    ValueError: what
[E 2022-11-10 12:24:31.115 ServerApp] wrote error: 'Unhandled error'
    Traceback (most recent call last):
      File "/Users/silvester/workspace/.venvs/jupyter_server/lib/python3.10/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
      File "/Users/silvester/workspace/jupyter_server/jupyter_server/services/sessions/handlers.py", line 55, in post
        raise ValueError('what')
    ValueError: what
[E 2022-11-10 12:24:31.115 ServerApp] {
      "Host": "localhost:8888",
      "Accept": "*/*",
      "Referer": "http://localhost:8888/notebooks/Untitled.ipynb?factory=Notebook",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0"
    }
[E 2022-11-10 12:24:31.115 ServerApp] 500 POST /api/sessions?1668104671111 (dc85ee701ce14062bbb2359cbe9dc4f4@127.0.0.1) 2.86ms referer=http://localhost:8888/notebooks/Untitled.ipynb?factory=Notebook

Before this change:

[E 2022-11-10 12:26:41.730 ServerApp] Uncaught exception POST /api/sessions?1668104801728 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions?1668104801728', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/Users/silvester/workspace/.venvs/jupyter_server/lib/python3.10/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
      File "/Users/silvester/workspace/jupyter_server/jupyter_server/services/sessions/handlers.py", line 55, in post
        raise ValueError('what')
    ValueError: what
[W 2022-11-10 12:26:41.733 ServerApp] wrote error: 'Unhandled error'
[E 2022-11-10 12:26:41.733 ServerApp] {
      "Host": "localhost:8888",
      "Accept": "*/*",
      "Referer": "http://localhost:8888/notebooks/Untitled.ipynb?factory=Notebook",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0"
    }
[E 2022-11-10 12:26:41.733 ServerApp] 500 POST /api/sessions?1668104801728 (dc85ee701ce14062bbb2359cbe9dc4f4@127.0.0.1) 2.68ms referer=http://localhost:8888/notebooks/Untitled.ipynb?factory=Notebook

@Carreau
Copy link
Contributor Author

Carreau commented Nov 11, 2022

Hum, this is strange, because I definitely had errors without any traceback. I'll recheck.

@Carreau
Copy link
Contributor Author

Carreau commented Jan 11, 2023

Let's close this for now to limit the number of opened PRs.

@Carreau Carreau closed this Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants