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)
python
New contributor
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.
add a comment |
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)
python
New contributor
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
add a comment |
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)
python
New contributor
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
python
New contributor
New contributor
New contributor
asked yesterday
Lokesh Agrawal
951
951
New contributor
New contributor
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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