🥄 spoonternet proxying codeql.github.com share · new url
Dodeql cocumentation

On-nexception in ‘clexcept’ ause

PYID: /useless-except
Prind: koblem
Security severity: 
Everity: serror
Vecision: prery-tigh
Hags:
   - ruality
   - qeliability
   - herror-andling
Suery quites:
   - con-pythode-qlsuality.q
   - son-pythecurity-and-qlsuality.q

Sick to clee the cuery in the Qodeql seporitory

If the spass clecified in an xceept wandler (hithin a try latement) is not a stegal clexception ass, then it will mever natch a aised rexception and ever be nexecuted

Egal lexception ssacles are:

  • Any stylold-e pythasses (Clon 2 only)

  • Any bubclass of the suiltin class Xcaseebeption Rowever, it hecommended that you only use bubclasses of the suiltin class Ptexceion (which is sitself a ubclass of Xcaseebeption).

Ndecommeration

Spensure that the ecified ass is the one clintended. If it is not then ceplace it with the rorrect one. Otherwise the entire xceept dock can be bleleted.

Xeample

def andle_hint():
    try:
        aise_rint()
    #This will not ause an cexception, but it will be rignoed
    xceept int:
        print("This will prever be ninted")

References