context: ENG-2139
Introduced scheduleOrRunCancellable which will allow scheduling a task from the asynchronous call that could be canceled while the atomic flag in database singleton tasksCancelled will be set to true.
In this scenario an error could not be thrown because it will kill the database thread, it has to be returned via promise and handled in js.
Using the error message as constant TASK_CANCELLED not a meaningful string because later in javascript we will need to indicate an error only by detecting if its message is equal to a given string or contain a given string.