Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exception context
#1
it is a commonly suggested idea to just let lower level code produce exceptions and let them propagate up to the caller that needs to handle them. but what if a function has 2 or 3 different lower level calls that could produce the same exception?

i'm working on a function to move a file object to inside of a target directory, creating that dictionary if needed. there are 3 contexts for exceptions like FileNotFoundError or PermissionError. it may refer to the file object to be moved. it might refer to the target dictionary. maybe it refers to creating the target directory.

how might such a function reveal the context of the error?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  function to store in caller's context Skaperen 7 3,027 Jul-27-2020, 08:45 PM
Last Post: Skaperen
  turning my function into a context manager Skaperen 2 1,964 Nov-14-2019, 09:08 PM
Last Post: Skaperen
  i want to make my own context manager Skaperen 0 1,670 Nov-10-2019, 05:21 AM
Last Post: Skaperen
  same context functions Skaperen 12 5,294 Jun-18-2019, 06:09 PM
Last Post: Skaperen
  Windows Context Menu Depth GWild 0 2,323 Jan-27-2018, 07:18 AM
Last Post: GWild

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020