Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

errorlib.py: Modified register_exception function #1

Closed
wants to merge 1 commit into from

5 participants

@GiorgosPa
Collaborator
  • Do not report KeyboardInterrupt exception
  • fixes #1701
@GiorgosPa GiorgosPa errorlib.py: Modified register_exception function
* Do not report KeyboardInterrupt exception
* fixes #1701
7389ba3
@jirikuncar jirikuncar commented on the diff
modules/miscutil/lib/errorlib.py
@@ -435,7 +436,10 @@ def register_exception(stream='error',
## let's log the exception and see whether we should report it.
pretty_notification_info = get_pretty_notification_info(exc_name, filename, line_no)
- if exception_should_be_notified(exc_name, filename, line_no) and (CFG_SITE_ADMIN_EMAIL_EXCEPTIONS > 1 or
+ #dont report KeyboardInterrupt exceptions
@jirikuncar Owner
# do not report KeyboardInterrupt exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jirikuncar jirikuncar commented on the diff
modules/miscutil/lib/errorlib.py
@@ -389,6 +389,7 @@ def register_exception(stream='error',
## Let's extract exception information
exc_info = sys.exc_info()
exc_name = exc_info[0].__name__
+
@jirikuncar Owner

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tiborsimko
Owner

@GiorgosPa @jalavik Do we want to pass silently all keyboard exceptions? Seems it can be useful to log these events down, since admins usually do not go along interrupting processes?

@Osso
Collaborator

I see 2 cases:

  • You run a function manually, it is computing a format to test, you press ctrl-c and everybody is notified for no reason, creating noise in the error libs.
  • A process is running in bibsched and receives a KeyboardInterrupt (why?!). Then we want to log this.

I think it makes more sense to modify the different code paths to reraise the keyboard interrupts instead of brushing the structure problems under the carpet. Unfortunately it is more work.

@tiborsimko tiborsimko referenced this pull request
Closed

WIP: new-prod #1903

@GiorgosPa GiorgosPa was unassigned by lnielsen
@tiborsimko tiborsimko was assigned by lnielsen
@tiborsimko tiborsimko added this to the v1.x milestone
@tiborsimko tiborsimko removed the in_triage label
@GiorgosPa GiorgosPa closed this
@GiorgosPa GiorgosPa deleted the branch
@jirikuncar jirikuncar removed the in_work label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2014
  1. @GiorgosPa

    errorlib.py: Modified register_exception function

    GiorgosPa authored GiorgosPa committed
    * Do not report KeyboardInterrupt exception
    * fixes #1701
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 modules/miscutil/lib/errorlib.py
View
6 modules/miscutil/lib/errorlib.py
@@ -389,6 +389,7 @@ def register_exception(stream='error',
## Let's extract exception information
exc_info = sys.exc_info()
exc_name = exc_info[0].__name__
+
@jirikuncar Owner

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
output = get_pretty_traceback(
req=req, exc_info=exc_info, skip_frames=2)
if output:
@@ -435,7 +436,10 @@ def register_exception(stream='error',
## let's log the exception and see whether we should report it.
pretty_notification_info = get_pretty_notification_info(exc_name, filename, line_no)
- if exception_should_be_notified(exc_name, filename, line_no) and (CFG_SITE_ADMIN_EMAIL_EXCEPTIONS > 1 or
+ #dont report KeyboardInterrupt exceptions
@jirikuncar Owner
# do not report KeyboardInterrupt exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ if exc_name == "KeyboardInterrupt":
+ return 1
+ elif exception_should_be_notified(exc_name, filename, line_no) and (CFG_SITE_ADMIN_EMAIL_EXCEPTIONS > 1 or
(alert_admin and CFG_SITE_ADMIN_EMAIL_EXCEPTIONS > 0) or
not written_to_log):
## If requested or if it's impossible to write in the log
Something went wrong with that request. Please try again.