ui-grid
ui-grid copied to clipboard
Exceptions raised by ui-grid or ui-grid plugin code is caught and not logged in the console
When an exception is raised, the end of the following code:
function startProcessor(i, renderedRowsToProcess) {
// Get the processor at 'i'
var processor = self.rowsProcessors[i].processor;
// Call the processor, passing in the rows to process and the current columns
// (note: it's wrapped in $q.when() in case the processor does not return a promise)
return $q.when( processor.call(self, renderedRowsToProcess, self.columns) )
.then(function handleProcessedRows(processedRows) {
// Check for errors
if (!processedRows) {
throw "Processor at index " + i + " did not return a set of renderable rows";
}
if (!angular.isArray(processedRows)) {
throw "Processor at index " + i + " did not return an array";
}
// Processor is done, increment the counter
i++;
// If we're not done with the processors, call the next one
if (i <= self.rowsProcessors.length - 1) {
return startProcessor(i, processedRows);
}
// We're done! Resolve the 'finished' promise
else {
finished.resolve(processedRows);
}
}).catch(angular.noop);
}
In the original code, the exception is rethrown using the following code.
}).catch(function(error) {
throw error;
});
The reason for raising this bug is that when using the ui-grid-auto-fit-columns plugin with in empty array of columnDefs, the plugin throws an exception but this exception cannot be seen in the console log to see the reason why the plugin is not working.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hey! I did some research over this. You can probably replace the string-based error messages with Error objects and add a catch block that logs the error to the console and then re-throws it. This allows the exception to propagate up the promise chain, ensuring that it's visible in the console. /* .catch(function handleError(error) { console.error("Error in startProcessor:", error); throw error; // Re-throw the error to allow it to propagate }); */