lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

Adjustments for Angular 1.6 #777

Closed MrWook closed 7 years ago

MrWook commented 7 years ago

Catch timeout promise on cancel because it will throw an error in Angular 1.6

lorenzofox3 commented 7 years ago

I'll get a look this week end. Thanks !

lorenzofox3 commented 7 years ago

Hi,

I don't understand what you are doing ? I have bumped angular version (to 1.6.X) on both doc website and development tests and I have no problem. So I am not sure to see what you are referring to ?

Also there is no point to catch an error without doing anything with it

Cheers,

Laurent

MrWook commented 7 years ago

Hey @lorenzofox3,

this "error" is referring to the changelog for 1.6.0-rc.0 bracing-vortex (2016-10-26)

c9dffd: report promises with non rejection callback Unhandled rejected promises will be logged to $exceptionHandler

Basicly a promise throws this error if it is not catched

Possibly unhandled rejection:

I recreated the error for you in this plunker It is copy paste from the Pipe example from the documentation. If you click a column header to sort the table too fast, the "$timeout" inside your code will be canceled and with the chang for promises it will throw an error. The catch that i added just prevent this.

Thought you can prevent the error for promises if you set $qProvider.errorOnUnhandledRejections(false) inside the config block from the angular module but i think this is not the right approach to disable this globaly for some people.

lorenzofox3 commented 7 years ago

I see. I don't believe to catch an exception and do nothing with it is a good idea though. In my opinion calling cancel on a timeout should not result in a rejection and be logged. Anyway. If you want to contribute I suggest you modify the source code instead of the dist folder. The dist file is regenerated automatically when the build is run and your changes might be overwritten

MrWook commented 7 years ago

I'm totaly on your side. I don't know why they did this kind of change. Sorry about that i close this and make a new one with the right files