Skip to content

fix: replace bare except with specific exception handling#2083

Open
Jah-yee wants to merge 1 commit intoTEN-framework:mainfrom
Jah-yee:fix/bare-except-clauses
Open

fix: replace bare except with specific exception handling#2083
Jah-yee wants to merge 1 commit intoTEN-framework:mainfrom
Jah-yee:fix/bare-except-clauses

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 3, 2026

Summary

Replace bare except: clauses with specific exception types in:

  • SIP server examples (Plivo, Telnyx, Twilio): except:except Exception:
  • Tencent TTS: except:except (json.JSONDecodeError, UnicodeDecodeError):

Why

Bare except: clauses catch KeyboardInterrupt and SystemExit, which is not recommended per PEP 8. Using specific exceptions improves code clarity and prevents unintended signal suppression.

Replace bare 'except:' clauses with specific exception types:
- SIP server examples (Plivo, Telnyx, Twilio): 'except:' → 'except Exception:'
- Tencent TTS: 'except:' → 'except (json.JSONDecodeError, UnicodeDecodeError):'

This follows PEP 8 recommendations and prevents catching
KeyboardInterrupt and SystemExit unexpectedly.
@Jah-yee Jah-yee force-pushed the fix/bare-except-clauses branch from 6c437ed to acae9ee Compare March 12, 2026 18:08
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

Successfully merging this pull request may close these issues.

1 participant