Changeset 54248f33 in trunk


Ignore:
Timestamp:
2020-07-09T18:35:14Z (5 years ago)
Author:
Sajith Sasidharan <sajith@…>
Branches:
master
Children:
2e160c1
Parents:
f9e864c5
git-author:
Sajith Sasidharan <sajith@…> (2020-07-09 14:01:13)
git-committer:
Sajith Sasidharan <sajith@…> (2020-07-09 18:35:14)
Message:

Use WebError?, not RuntimeError?, to indicate error

Several problems with using RuntimeError? to signal error here:

  • It dumps a rather unhelpful webpage at the user.
  • The exception backtrace on Tahoe console is not quite necessary here.
  • It really is not a runtime error: it is just an expected failure.
  • But mainly, testing for RuntimeError? is harder.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/web/status.py

    rf9e864c5 r54248f33  
    2626    MultiFormatResource,
    2727    SlotsSequenceElement,
     28    WebError,
    2829)
    2930
     
    11721173            stype, count_s = path.split("-")
    11731174        except ValueError:
    1174             raise RuntimeError(
    1175                 "no - in '{}'".format(path)
    1176             )
     1175            raise WebError("no '-' in '{}'".format(path))
    11771176        count = int(count_s)
    11781177        if stype == "up":
Note: See TracChangeset for help on using the changeset viewer.