I am writing a class to download a csv file with data from the db.
The methodology I used is as follows
1. A main method which calls other methods
eg:
public function main(){
$this->a();
$this->b();
$this->c();
}
suppose method a is validation, b is query execution and c is file download. These 3 methods have chances of producing error eg: error in query execution, error in download etc
when ever I have error in any of these methods I have to return back and display the error. What is the best way to handle this?