Skip to content

How to get cell location in case of an error and print in catch block #2637

Answered by saginadav
saginadav asked this question in Q&A
Discussion options

You must be logged in to vote

this is what finally worked

try {                      
                              $sheet->setCellValueExplicit($cell,$innervalue, $dataType[0]);
                              }
                              catch (\Exception $e) {
                                $errorMsg = 'the value of:\' '  .$innervalue . '\' in cell ' .  $cell .  ' in header: ' . $headerArray[$headerIndex] . 'problematic'  ;
                                \Log::error($errorMsg);
                                \Log::error($e->getMessage()); 
                                \Log::error($e->getTraceAsString());  
                                throw new Exception($e->getMessage());
                              
 …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by saginadav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants