Skip to content

Raise BNLPeople exceptions for callers to process or propagate #272

Open

Description

There is an inconsistency in how certain BNL People exceptions are handled in the bnlpeople_service module.

https://github.com/NSLS2/nsls2api/pull/268/changes/BASE..7c3d248a3d812dd7884dd3c24cf5d165a64ea9a0#diff-e14764f40f624b42a57278e2039c601c081f2c0ba263626458b38e215c43fc2a

  • get_person_by_username() makes a bare call to _call_bnlpeople_webservice().
  • get_username_by_id() historically makes a guarded call to _call_bnlpeople_webservice() swallowing all exceptions and returning None in that case.
  • get_person_by_id() historically made a bare call _call_bnlpeople_webservice(); PR Fix/lookup error 404 #268 changes this to to a guarded call to _call_bnlpeople_webservice() swallowing all exceptions and returning None in that case.

Anecdotally the reason to swallow the exception is to avoid interrupting batch processing.

That suggests that the decision to ignore or propagate the exception belongs at a higher level -- probably in the batch code that calls this function -- rather than in these functions.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions