Catch and Raise exceptions at all layers? [on hold]











up vote
-3
down vote

favorite












Is it considered a good practice to catch and raise exceptions at all layers?
For example:



def func():
try:
func1()
except PersistenceReaderError as exception:
raise error

def func1():
try:
func2()
except PersistenceReaderError as exception:
raise error

def func2():
try:
func3()
except (NotAFileError, FileDoesNotExistError, FileNotReadableError) as exception:
raise PersistenceReaderError(exception.message)









share|improve this question







New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2




    I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
    – Toby Speight
    yesterday















up vote
-3
down vote

favorite












Is it considered a good practice to catch and raise exceptions at all layers?
For example:



def func():
try:
func1()
except PersistenceReaderError as exception:
raise error

def func1():
try:
func2()
except PersistenceReaderError as exception:
raise error

def func2():
try:
func3()
except (NotAFileError, FileDoesNotExistError, FileNotReadableError) as exception:
raise PersistenceReaderError(exception.message)









share|improve this question







New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2




    I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
    – Toby Speight
    yesterday













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











Is it considered a good practice to catch and raise exceptions at all layers?
For example:



def func():
try:
func1()
except PersistenceReaderError as exception:
raise error

def func1():
try:
func2()
except PersistenceReaderError as exception:
raise error

def func2():
try:
func3()
except (NotAFileError, FileDoesNotExistError, FileNotReadableError) as exception:
raise PersistenceReaderError(exception.message)









share|improve this question







New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Is it considered a good practice to catch and raise exceptions at all layers?
For example:



def func():
try:
func1()
except PersistenceReaderError as exception:
raise error

def func1():
try:
func2()
except PersistenceReaderError as exception:
raise error

def func2():
try:
func3()
except (NotAFileError, FileDoesNotExistError, FileNotReadableError) as exception:
raise PersistenceReaderError(exception.message)






python






share|improve this question







New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Lokesh Agrawal

951




951




New contributor




Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Lokesh Agrawal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Toby Speight, Mast, Janne Karila, Ismael Miguel, Graipher

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2




    I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
    – Toby Speight
    yesterday














  • 2




    I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
    – Toby Speight
    yesterday








2




2




I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
– Toby Speight
yesterday




I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?
– Toby Speight
yesterday















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei