Skip to content

Commit

Permalink
Fix error on resizing
Browse files Browse the repository at this point in the history
This error "RenderingCanceledError: Page rendering has been canceled" occurred because
`class RenderingCanceledError extends Error` was defined incompletely.
```
    Object.setPrototypeOf(this, RenderingCanceledError.prototype);
```
is necessary because [Extending built-ins like Error, Array, and Map may no longer work](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)
  • Loading branch information
MurakamiShinyu committed Aug 19, 2019
1 parent 2245bba commit b833976
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ts/adapt/adaptviewer.ts
Expand Up @@ -1218,6 +1218,9 @@ class RenderingCanceledError extends Error {

constructor() {
super();
// Set the prototype explicitly.
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(this, RenderingCanceledError.prototype);
this.stack = new Error().stack;
}
}
Expand Down

0 comments on commit b833976

Please sign in to comment.