]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Improve error message with id of the canvas (#10495)
authorJacco van den Berg <jaccoberg2281@gmail.com>
Wed, 20 Jul 2022 16:51:34 +0000 (18:51 +0200)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 16:51:34 +0000 (12:51 -0400)
* improve error message with id of the canvas
* update test

src/core/core.controller.js
test/specs/core.controller.tests.js

index 17923d90abad35544e4b478bfec0033575ddfa0f..907f4d198ece003908cf00023297a96794356a60 100644 (file)
@@ -111,7 +111,7 @@ class Chart {
     if (existingChart) {
       throw new Error(
         'Canvas is already in use. Chart with ID \'' + existingChart.id + '\'' +
-                               ' must be destroyed before the canvas can be reused.'
+                               ' must be destroyed before the canvas with ID \'' + existingChart.canvas.id + '\' can be reused.'
       );
     }
 
index 4798f33075391ed8b63980e856f9c4fab04b70d1..90d31d06162d162ba27d5f4c55ef78091d91a0a2 100644 (file)
@@ -32,7 +32,7 @@ describe('Chart', function() {
     expect(createChart).toThrow(new Error(
       'Canvas is already in use. ' +
                        'Chart with ID \'' + chart.id + '\'' +
-                       ' must be destroyed before the canvas can be reused.'
+                       ' must be destroyed before the canvas with ID \'' + chart.canvas.id + '\' can be reused.'
     ));
 
     chart.destroy();